added function to extract list values from cells

This commit is contained in:
spbeach46 2021-02-08 20:16:58 -07:00
parent 855e65af80
commit 816fb797fa

View File

@ -171,6 +171,9 @@ class CurateData:
nvl_training = pd.concat([pd.Series(training.PictureURL), nvl_df], axis=1)
return nvl_training
def extract_contents(self, df):
extracted_df = df.applymap(lambda x: ' '.join(x) if pd.notnull(x) else np.nan) # TODO does it work?
def drop_nvl_cols(self, nvl_training):
col_drop = [
'Fabric Type', 'Type of Sport', 'Mid Sole', 'Modified Item',
@ -206,8 +209,8 @@ class CurateData:
dropd_nvl_training = nvl_training.drop(col_drop, axis=1)
return dropd_nvl_training
def combine_nvlclass(self):
final_training = pd.concat([class_training, dropd_nvl_trainig], axis=1)
def combine_nvlclass(self, class_training, dropd_nvl_training):
final_training = pd.concat([class_training, dropd_nvl_training], axis=1)
return final_training
# TODO Still need to to extract strings from list of strings and then drop which ones you don't want or vice versa. You may have to avoid using cells with lists of strings longer than one (e.g., 'Features')