Skip to content

Unpickling of pre 0.15 gzip-compressed objects not possible #10966

Closed
@jphme

Description

@jphme

I pickled and gzip_compressed DataFrames in a tuple pre-0.15

with gzip.open('/tmp/test.pklz', 'wb') as datafile:
    pickle.dump((df1,df2), datafile)

Pre-0.15 i would load them again like:

with gzip.open('/tmp/test.pklz', 'rb') as datafile:
    df1, df2 = pickle.load(datafile)

Now after updating pandas, I can't load them back anyme:

>> TypeError: _reconstruct: First argument must be a sub-type of ndarray

If I directly try pd.read_pickle, it can't decrompress the file properly:

 df1, df2= pd.read_pickle('/tmp/test.pklz')
>> KeyError: '\x1f'

Reading the decompressed file does not work too:

with gzip.open('/tmp/test.pklz', 'rb') as datafile:
    df1, df2 = pd.read_pickle(datafile)
>> TypeError: coercing to Unicode: need string or buffer, GzipFile found

Is there any solution for this? This seems to be a serious issue for backwards compatibility if you need to downgrade pandas again to get the data back if there is no backup in other formats.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Compatpandas objects compatability with Numpy or Python functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions