[SOLVED] CS import pandas as pd

$25

File Name: CS_import_pandas_as_pd.zip
File Size: 207.24 KB

5/5 - (1 vote)

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.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS import pandas as pd
$25