#magento_1_upload_file_with_image_urls_no_desc['magento_2_upload_file_with_data_no_desc['gallery_image_url_1'] = raw_df['Additional Product Picture 1']magento_2_upload_file_with_data_no_desc['gallery_image_url_2'] = raw_df['Additional Product Picture 2']magento_2_upload_file_with_data_no_desc['gallery_image_url_3'] = raw_df['Additional Product Picture 3']magento_2_upload_file_with_data_no_desc['gallery_image_url_4'] = raw_df['Additional Product Picture 4']magento_2_upload_file_with_data_no_desc['gallery_image_url_5'] = raw_df['Additional Product Picture 5']magento_2_upload_file_with_data_no_desc['gallery_image_url_6'] = raw_df['Additional Product Picture 6']magento_2_upload_file_with_data_no_desc['gallery_image_url_7'] = raw_df['Additional Product Picture 7']magento_2_upload_file_with_data_no_desc['gallery_image_url_8'] = raw_df['Additional Product Picture 8']magento_2_upload_file_with_data_no_desc['gallery_image_url_9'] = raw_df['Additional Product Picture 9']magento_2_upload_file_with_data_no_desc['gallery_image_url_10'] = raw_df['Additional Product Picture 10']magento_2_upload_file_with_data_no_desc['image'] = raw_df['Main Product Picture']magento_2_upload_file_with_data_no_desc['small_image'] = raw_df['Additional Product Picture 1']
In [113]:
magento_2_upload_file_with_data_no_desc.head(2)
Out[113]:
product_idskunameraw_pricecheapest_courier_shippingproduct_eanshopforsoul_profitebay_profitshopforsoul_costprice…gallery_image_url_4gallery_image_url_5gallery_image_url_6gallery_image_url_7gallery_image_url_8gallery_image_url_9gallery_image_url_10imagesmall_imageremote_image_url030399shopforsoul-A01AL3301111Black 3x3x3 MoYu AoLong V2 Puzzle-A01AL330111112.90500.06941377886603.0109.658109.658669.21778.87.
2 rows × 76 columns
In [114]:
magento_2_upload_file_with_data_no_desc.to_csv(output_folder + 'images_all_to_upload_without_description_' + input_file_name + '_magento_2_' + today + '.csv',index=False, encoding='utf8')
In [115]:
Partition the data file into 20 partitions.
partition = 20increment = int(round(magento_2_upload_file_with_data_no_desc.shape[0]/partition,0)) + 1incrementstart = 0for count in range(0, partition): start += increment p = magento_2_upload_file_with_data_no_desc[start:start + increment] #print(p.head(1)) p.to_csv(output_folder + 'partition-' + str(count) + '-image-magento2_all_to_upload_with_description_' + today + '.csv', index=False)
In [116]:
df_new_template = pd.DataFrame()df_new_template = pd.read_csv(template_folder + 'import-magento2-all-but-descriptions.csv')df_new_template.head(1)
Out[116]:
product_idskunameraw_pricedummycheapest_courier_shippingproduct_eanshopforsoul_profitebay_profitshopforsoul_cost…gallery_image_url_4gallery_image_url_5gallery_image_url_6gallery_image_url_7gallery_image_url_8gallery_image_url_9gallery_image_url_10imagesmall_imageremote_image_url028471ShopForSoul-PCO_004SZTH7OnePlus 7 Smartphone 12GB RAM 256GB ROM Snapdr…856.0350012.036941377796025182.82182.821097.21
1 rows × 77 columns
In [117]:
magento_2_upload_file_with_data_no_desc.columns, df_new_template.columns
Out[117]:
(Index(['product_id', 'sku', 'name', 'raw_price', 'cheapest_courier_shipping',
'product_ean', 'shopforsoul_profit', 'ebay_profit', 'shopforsoul_cost',
'price', 'special_price', 'special_from_date', 'special_to_date',
'ebay_cost', 'ebay_list_price', 'amazon_profit', 'amazon_our_cost',
'amazon_list_price', 'amazon_special_price', 'amazon_list_price_usd',
'amazon_special_price_usd', 'amazon_list_price_gbp',
'amazon_special_price_gbp', 'amazon_list_price_eu',
'amazon_special_price_eu', 'weight', 'is_in_stock', 'categories',
'visibility', 'height', 'width', 'length', 'status',
'attribute_set_code', 'product_online', 'product_type',
'product_websites', 'root_category', 'store_view_code',
'tax_class_name', '_attribute_set', 'qty', 'min_qty',
'use_config_min_qty', 'is_qty_decimal', 'backorders',
'use_config_backorders', 'min_sale_qty', 'use_config_min_sale_qty',
'max_sale_qty', 'use_config_max_sale_qty', 'notify_stock_qty',
'use_config_notify_stock_qty', 'manage_stock',
'use_config_manage_stock', 'stock_status_changed_auto',
'use_config_qty_increments', 'qty_increments',
'use_config_enable_qty_inc', 'enable_qty_increments',
'is_decimal_divided', '_media_is_disabled', 'tax_class_id',
'gallery_image_url_1', 'gallery_image_url_2', 'gallery_image_url_3',
'gallery_image_url_4', 'gallery_image_url_5', 'gallery_image_url_6',
'gallery_image_url_7', 'gallery_image_url_8', 'gallery_image_url_9',
'gallery_image_url_10', 'image', 'small_image', 'remote_image_url'],
dtype='object'),
Index(['product_id', 'sku', 'name', 'raw_price', 'dummy',
'cheapest_courier_shipping', 'product_ean', 'shopforsoul_profit',
'ebay_profit', 'shopforsoul_cost', 'price', 'special_price',
'special_from_date', 'special_to_date', 'ebay_cost', 'ebay_list_price',
'amazon_profit', 'amazon_our_cost', 'amazon_list_price',
'amazon_special_price', 'amazon_list_price_usd',
'amazon_special_price_usd', 'amazon_list_price_gbp',
'amazon_special_price_gbp', 'amazon_list_price_eu',
'amazon_special_price_eu', 'weight', 'is_in_stock', 'categories',
'root_category', 'visibility', 'height', 'width', 'length', 'status',
'product_type', '_attribute_set', 'qty', 'min_qty',
'use_config_min_qty', 'is_qty_decimal', 'backorders',
'use_config_backorders', 'min_sale_qty', 'use_config_min_sale_qty',
'max_sale_qty', 'use_config_max_sale_qty', 'notify_stock_qty',
'use_config_notify_stock_qty', 'manage_stock',
'use_config_manage_stock', 'stock_status_changed_auto',
'use_config_qty_increments', 'qty_increments',
'use_config_enable_qty_inc', 'enable_qty_increments',
'is_decimal_divided', '_media_is_disabled', 'tax_class_id',
'tax_class_name', 'store_view_code', 'attribute_set_code',
'product_websites', 'product_online', 'gallery_image_url_1',
'gallery_image_url_2', 'gallery_image_url_3', 'gallery_image_url_4',
'gallery_image_url_5', 'gallery_image_url_6', 'gallery_image_url_7',
'gallery_image_url_8', 'gallery_image_url_9', 'gallery_image_url_10',
'image', 'small_image', 'remote_image_url'],
dtype='object'))
In [118]:
set(df_new_template.columns).difference(set(magento_2_upload_file_with_data_no_desc))
Out[118]:
{'dummy'}
In [119]:
set(magento_2_upload_file_with_data_no_desc ).difference(set(df_new_template.columns))
Out[119]:
set()
— — — — — — — — — — –
All code in one block.
magento_2_upload_file_with_data_no_desc[‘gallery_image_url_1’] = raw_df[‘Additional Product Picture 1’]
magento_2_upload_file_with_data_no_desc[‘gallery_image_url_2’] = raw_df[‘Additional Product Picture 2’]
magento_2_upload_file_with_data_no_desc[‘gallery_image_url_3’] = raw_df[‘Additional Product Picture 3’]
magento_2_upload_file_with_data_no_desc[‘gallery_image_url_4’] = raw_df[‘Additional Product Picture 4’]
magento_2_upload_file_with_data_no_desc[‘gallery_image_url_5’] = raw_df[‘Additional Product Picture 5’]
magento_2_upload_file_with_data_no_desc[‘gallery_image_url_6’] = raw_df[‘Additional Product Picture 6’]
magento_2_upload_file_with_data_no_desc[‘gallery_image_url_7’] = raw_df[‘Additional Product Picture 7’]
magento_2_upload_file_with_data_no_desc[‘gallery_image_url_8’] = raw_df[‘Additional Product Picture 8’]
magento_2_upload_file_with_data_no_desc[‘gallery_image_url_9’] = raw_df[‘Additional Product Picture 9’]
magento_2_upload_file_with_data_no_desc[‘gallery_image_url_10’] = raw_df[‘Additional Product Picture 10’]
magento_2_upload_file_with_data_no_desc[‘image’] = raw_df[‘Main Product Picture’]
magento_2_upload_file_with_data_no_desc[‘small_image’] = raw_df[‘Additional Product Picture 1’]
magento_2_upload_file_with_data_no_desc[‘remote_image_url’] = raw_df[‘Main Product Picture’]# In[ ]:magento_2_upload_file_with_data_no_desc.head(2)# In[ ]:magento_2_upload_file_with_data_no_desc.to_csv(output_folder + ‘images_all_to_upload_without_description_’ + input_file_name + ‘_magento_2_’ + today + ‘.csv’,index=False, encoding=’utf8')# In[ ]:partition = 20
increment = int(round(magento_2_upload_file_with_data_no_desc.shape[0]/partition,0)) + 1
incrementstart = 0
for count in range(0, partition):
start += increment
p = magento_2_upload_file_with_data_no_desc[start:start + increment]
#print(p.head(1))
p.to_csv(output_folder + ‘partition-’ + str(count) + ‘-image-magento2_all_to_upload_with_description_’ + today + ‘.csv’, index=False)# In[ ]:df_new_template = pd.DataFrame()
df_new_template = pd.read_csv(template_folder + ‘import-magento2-all-but-descriptions.csv’)
df_new_template.head(1)# In[ ]:magento_2_upload_file_with_data_no_desc.columns, df_new_template.columns# In[ ]:set(df_new_template.columns).difference(set(magento_2_upload_file_with_data_no_desc))# In[ ]:set(magento_2_upload_file_with_data_no_desc ).difference(set(df_new_template.columns))# In[ ]:
Medium: https://medium.com/@SayedAhmedCanada
*** . *** *** . *** . *** . ***
Sayed Ahmed
BSc. Eng. in Comp. Sc. & Eng. (BUET)
MSc. in Comp. Sc. (U of Manitoba, Canada)
MSc. in Data Science and Analytics (Ryerson University, Canada)
Linkedin: https://ca.linkedin.com/in/sayedjustetc
Blog: http://Bangla.SaLearningSchool.com, http://SitesTree.com
Training Courses: http://Training.SitesTree.com
8112223 Canada Inc/Justetc: http://JustEtc.net
Facebook Groups/Forums to discuss (Q & A):
https://www.facebook.com/banglasalearningschool
https://www.facebook.com/justetcsocial
Get access to courses on Big Data, Data Science, AI, Cloud, Linux, System Admin, Web Development and Misc. related. Also, create your own course to sell to others. http://sitestree.com/training/
Build Ecommerce Software and Systems
Build Ecommerce Software and Systems
WRITTEN BY

