Re: Pandas: Multiple CSVs in one Zip file

2021-08-26 Thread Peter J. Holzer
On 2021-08-26 11:09:21 +0400, 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

Is it possible that you are trying to treat the zip file as a gzip file?
Those are different file formats with different purposes (archive vs.
stream), but they use the same compression algorithm, and the gzip tool
(and - I presume - also the gzip library) can read a zip file with a
single member. The error message would match that.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas: Multiple CSVs in one Zip file

2021-08-26 Thread Peter Otten

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.

--
https://mail.python.org/mailman/listinfo/python-list


Pandas: Multiple CSVs in one Zip file

2021-08-26 Thread Abdur-Rahmaan Janhangeer
Greetings,

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

Kind Regards,

Abdur-Rahmaan Janhangeer
about  | blog

github 
Mauritius
-- 
https://mail.python.org/mailman/listinfo/python-list