Pandas: Multiple CSVs in one Zip file

Peter Otten __peter__ at web.de
Thu Aug 26 03:38:38 EDT 2021


On 26/08/2021 09:09, Abdur-Rahmaan Janhangeer wrote:

> Cannot read one file in a zip file if the zip file contains multiple files.
> 
> This example does not work https://www.py4u.net/discuss/203494 as Pandas
> shows a ValueError: Multiple files found in ZIP file. Only one file per ZIP.
> 
> If the Zip file has one file, fine else i cannot find a way. Thanks

You may have introduced an error when you translated the snippet to your 
use case. What went wrong is hard to guess unless you provide the exact 
failing code.

Pandas can read a single zipped file out of the box and the accepted 
answer in your indirect link to

https://stackoverflow.com/questions/61971040/python-extract-csv-files-from-multiple-zip-files-and-combine-the-data

shows how to deal with zip files containing multiple files.



More information about the Python-list mailing list