def read_pickle(path):
 def try_read(path, encoding=None):
  try:
   with open(path, 'rb') as fh:
    return pkl.load(fh)
  except Exception:
   try:
    with open(path, 'rb') as fh:
     return pc.load(fh, encoding=encoding, compat=False)
   except:
    with open(path, 'rb') as fh:
     return pc.load(fh, encoding=encoding, compat=True)
 try:
  return try_read(path)
 except:
  if PY3:
   return try_read(path, encoding='latin1')
  raise

def read_pickle ( path ) : def try_read ( path , encoding = None ) : try : with open ( path , 'rb' ) as fh : return pkl . load ( fh ) except Exception : try : with open ( path , 'rb' ) as fh : return pc . load ( fh , encoding = encoding , compat = False ) except : with open ( path , 'rb' ) as fh : return pc . load ( fh , encoding = encoding , compat = True ) try : return try_read ( path ) except : if PY3 : return try_read ( path , encoding = 'latin1' ) raise
load pickled pandas object from the specified file path warning: loading pickled data received from untrusted sources can be unsafe .