Here's a question. Question how to load and merge multiple csv files in a folder

Asked 1 weeks ago, Updated 1 weeks ago, 1 views

I'm using Jupiter laptop,

path = 'data/test'

Wash_data_202110110909.csv

Wash_data_202110110910.csv

Wash_data_202110110911.csv

Wash_data_202110110912.csv

'

'

'

There are more than 2000 csv files in the same name format as above.

I'd like to bring up the csv files in the folder at once and combine them. (in pandas data frame format)

By the way, there is also a csv file with data of 0 (capacity 0 kb) in between.

How can we exclude these files and attach only the csv file that has the data?

jupyter-notebook

2022-09-20 14:56

1 Answers

If the capacity is zero, there will be an exception when reading, so you can make an exception and bypass it.

However, I understand that there is no function in Pandas to make multiple files into one data frame. In other words, you have to read the file one by one as a repetitive operation and concatenate it to create one large data frame.


2022-09-20 14:56

If you have any answers or tips


© 2022 pinfo. All rights reserved.