Python: Ecommerce: Part — 7: Partition a Data File (with product information) into Multiple Files.

In previous steps, we created a product data file to be uploaded to Magento 2 (from supplier data). However, there is a limit, how big a file can be uploaded to Magento 2 for product data import. Hence, this code will divide the data file into multiple files. This data file does not include image URLs. We will go there. If you have image URLs, magento upload process can upload images as well. In that case, the file becomes big as well as the product update can take a long time.

magento_2_upload_file_with_data_no_desc.to_csv( output_folder + 'no-image-all_to_upload_without_description_' + input_file_name + '_magento_2_' + today + '.csv',index=False, encoding='utf8')

In [98]:

# divide the output into multiple files

In [99]:

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) + '-no-image-  magento2_all_to_upload_with_description_' + today + '.csv', index=False);

All code in One Block

# divide the output into multiple files# In[106]: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) + ‘-no-image-magento2_all_to_upload_with_description_’ + today + ‘.csv’, index=False);# In[107]:

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)

Linkedinhttps://ca.linkedin.com/in/sayedjustetc

Bloghttp://Bangla.SaLearningSchool.comhttp://SitesTree.com

Training Courses: http://Training.SitesTree.com

8112223 Canada Inc/Justetchttp://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

8112223 Canada Inc. (Justetc)

WRITTEN BY

Software Engineer, Data Scientist, Machine Learning Engineer.

Build Ecommerce Software and Systems

Build Ecommerce Software and Systems

Write the first response