diff --git a/ebay_api.py b/ebay_api.py index e115655..f1077fe 100644 --- a/ebay_api.py +++ b/ebay_api.py @@ -267,21 +267,21 @@ class CurateData: instances. Modifies both class training and dropd dfs. Appends custom image url dict {'source':'destination'}. ''' - expanded_class_training = class_training.explode('PictureURL').reset_index(drop=True) - # expanded_class_training.PictureURL.apply(lambda x: 'c:/users/unknown/ - expanded_dropd = dropd.explode('PictureURL').reset_index(drop=True) + expanded_class = class_training.explode('PictureURL').reset_index(drop=True) # TODO DROp rows with nan values in PicturlURL cell + expanded_class = expanded_class.dropna(subset=['PictureURL']) + expanded_dropd = dropd.explode('PictureURL').reset_index(drop=True) # TODO Drop rows with nan values in PictureURL cells either here or before somewhere + expanded_dropd = expanded_dropd.dropna(subset=['PictureURL']) expanded_dropd = self.extract_df(expanded_dropd) # convert lists to values - # expanded_dropd.PictureURL.apply(lambda x: 'c:/users/unknown/ - # curate.make_dict_pics(expanded_class_training) # custom image url dict - dict_pics_list = set(expanded_class_training.PictureURL.to_list()) # prolly need to create set long before df... immediately after Shopping or trading call + dict_pics_list = list(set(expanded_class.PictureURL.to_list())) # prolly need to create set long before df... immediately after Shopping or trading call destination = 'your target folder' # decide whether or not you want to set a default folder to have the user define it as input every time. or have this only # defined in the download function - dict_pics = {k:destination+re.search(r'\w+(?=/\$_)', k).group()+'.jpg' for k in dict_pics_list} # TODO determine how to implement destination variable + dict_pics = {k:destination+re.search(r'[^/]+(?=/\$_|.jpg)', k).group()+'.jpg' for k in dict_pics_list} # TODO determine how to implement destination variable + # TODO still getting exceptions such as 'https://i.ebayimg.com/images/g/RG8AAOSwqMtd1esL/s-l1600.jpg'. add conditions to dict comprehension. # re.search(r'\w+(?=/\$_)', a).group() - return expanded_class_training, expanded_dropd, dict_pics # TODO still need to replace source url to destination url in df cols and create custom dict {, } + return expanded_class, expanded_dropd # TODO still need to replace source url to destination url in df cols and create custom dict {, } def dl_pictures(self): '''