I have a couple of WinZipped csv files and would like to read these in as a Pandas dataframe. The problem is that neither of the decompression options ('gzip' or 'bz2') seems to work. Here's what the file looks like:
00000000011!00023011!89011!200812
00000000012!00023011!89011!200812
00000000013!00023011!89011!200812
So it seems that I am going to have to unzip the file using Python's zipfile module, read in the lines and create a dataframe from what I read in. The way I thought about doing this is creating a list of dictionaries like this:
[
{"header1": 00000000011, "header2": 00023011, "header3": 89011, "header4": 200812},
{"header1": 00000000012, "header2": 00023011, "header3": 89011, "header4": 200812},
...
]
and then convert this to a dataframe as in http://pandas.pydata.org/pandas-docs/stable/dsintro.html#from-a-list-of-dicts.
However, this seems to involve a lot of manual manipulating of lines - is there any better way to do this?