Skip to content

Commit bd1df2e

Browse files
authored
backward compatibility for caching done with old pandas indeces (brain-score#11)
1 parent 94cb58c commit bd1df2e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

result_caching/__init__.py

+6-2
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,8 +139,11 @@ 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-
142+
try:
143+
data = pickle.load(f)['data']
144+
catch:
145+
data = pd.read_pickle(f)['data']
146+
return data
143147

144148
class _NetcdfStorage(_DiskStorage):
145149
def storage_path(self, function_identifier):

0 commit comments

Comments
 (0)