Reading CSV data from a compressed file
Pandas allows for reading directly from a compressed file, such as .zip , .gz , .bz2 , or .xz (but not .7z). The only requirement is that the intended data file (CSV) is the only file inside the compressed file.
Importing libraries and packages
Loading datasets
|
Column 1 |
Column 2 |
Column 3 |
Column 4 |
0 |
2 |
1500 |
Good |
300000 |
1 |
3 |
1300 |
Fair |
240000 |
2 |
3 |
1900 |
Very good |
450000 |
3 |
3 |
1850 |
Bad |
280000 |
4 |
2 |
1640 |
Good |
310000 |
|
example_1.csv |
Column 2 |
Column 3 |
Column 4 |
0 |
2.0 |
1500.0 |
Good |
300000.0 |
1 |
3.0 |
1300.0 |
Fair |
240000.0 |
2 |
3.0 |
1900.0 |
Very good |
450000.0 |
3 |
3.0 |
1850.0 |
Bad |
280000.0 |
4 |
2.0 |
1640.0 |
Good |
310000.0 |
5 |
NaN |
NaN |
NaN |
NaN |