How do I split a csv file in Python?

How do I split a csv file in Python?
Answer
Splitting CSV Files in Python
  1. import pandas as pd. #csv file name to be read in.
  2. in_csv = ‘input.csv’ #get the number of lines of the csv file to be read.
  3. number_lines = sum(1 for row in (open(in_csv))) …
  4. rowsize = 500. …
  5. df = pd. …
  6. skiprows = i)#skip rows that have been read. …
  7. out_csv = ‘input’ + str(i) + ‘.csv’ …
  8. header=False,
8 окт. 2020 г.
 

Tìm kiếm

Back
Top