From 816fb797faa2f8664e7894ea2d809ee195ba7428 Mon Sep 17 00:00:00 2001 From: spbeach46 Date: Mon, 8 Feb 2021 20:16:58 -0700 Subject: [PATCH] added function to extract list values from cells --- ebay_api.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ebay_api.py b/ebay_api.py index a876f50..534cf36 100644 --- a/ebay_api.py +++ b/ebay_api.py @@ -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')