Nguyễn Văn Nhật
New member
How do I split a csv file in Python?
Answer
Splitting CSV Files in Python
Answer
Splitting CSV Files in Python
- import pandas as pd. #csv file name to be read in.
- in_csv = ‘input.csv’ #get the number of lines of the csv file to be read.
- number_lines = sum(1 for row in (open(in_csv))) …
- rowsize = 500. …
- df = pd. …
- skiprows = i)#skip rows that have been read. …
- out_csv = ‘input’ + str(i) + ‘.csv’ …
- header=False,