Skip to content

Commit 9e922ad

Browse files
authored
backward compatibility for caching done with old pandas indices
Corrects brain-score#11 I encountered FrozenIndices Error trying to load a pandas dataframe after updating my pandas version. This commit introduces backward compatibility, i.e. you are fine if you pickle.dump() using an old pandas' version and trying to load using a new pandas' version. pandas-dev/pandas#34535 pickle.load() still called for all non Dataframe objects see https://github.com/pandas-dev/pandas/blob/f2c8480af2f25efdbd803218b9d87980f416563e/pandas/io/pickle.py#L203
1 parent 47d5479 commit 9e922ad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

result_caching/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import itertools
55
import logging
66
import numpy as np
7+
import pandas as pd
78
import os
89
import pickle
910
import xarray as xr
@@ -138,7 +139,7 @@ def load(self, function_identifier):
138139

139140
def load_file(self, path):
140141
with open(path, 'rb') as f:
141-
return pickle.load(f)['data']
142+
return pd.read_pickle(f)['data']
142143

143144

144145
class _NetcdfStorage(_DiskStorage):

0 commit comments

Comments
 (0)