import pandas as pd
import numpy as np
################# helper functions #################
# helper functions
def project_data(df, d):
# Return only the d-th column of INPUT
return df.iloc[:, d]
def select_data(df, d, val):
# SELECT * FROM INPUT WHERE input.d = val
col_name = df.columns[d]
return df[df[col_name] == val]
def remove_first_dim(df):
# Remove the first dim of the input
return df.iloc[:, 1:]
def slice_data_dim0(df, v):
# syntactic sugar to get R_{ALL} in a less verbose way
df_temp = select_data(df, 0, v)
return remove_first_dim(df_temp)
######################
Reviews
There are no reviews yet.