本文整理汇总了Python中pandas.io.pickle.read_pickle方法的典型用法代码示例。如果您正苦于以下问题:Python pickle.read_pickle方法的具体用法?Python pickle.read_pickle怎么用?Python pickle.read_pickle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.io.pickle
的用法示例。
在下文中一共展示了pickle.read_pickle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load
# 需要导入模块: from pandas.io import pickle [as 别名]
# 或者: from pandas.io.pickle import read_pickle [as 别名]
def load(path): # TODO remove in 0.13
"""
Load pickled pandas object (or any other pickled object) from the specified
file path
Warning: Loading pickled data received from untrusted sources can be
unsafe. See: http://docs.python.org/2.7/library/pickle.html
Parameters
----------
path : string
File path
Returns
-------
unpickled : type of object stored in file
"""
import warnings
warnings.warn("load is deprecated, use read_pickle", FutureWarning)
from pandas.io.pickle import read_pickle
return read_pickle(path)
示例2: test_pickle_v0_15_2
# 需要导入模块: from pandas.io import pickle [as 别名]
# 或者: from pandas.io.pickle import read_pickle [as 别名]
def test_pickle_v0_15_2(self, datapath):
offsets = {'DateOffset': DateOffset(years=1),
'MonthBegin': MonthBegin(1),
'Day': Day(1),
'YearBegin': YearBegin(1),
'Week': Week(1)}
pickle_path = datapath('tseries', 'offsets', 'data',
'dateoffset_0_15_2.pickle')
# This code was executed once on v0.15.2 to generate the pickle:
# with open(pickle_path, 'wb') as f: pickle.dump(offsets, f)
#
tm.assert_dict_equal(offsets, read_pickle(pickle_path))
示例3: test_pickle_compat_0_14_1
# 需要导入模块: from pandas.io import pickle [as 别名]
# 或者: from pandas.io.pickle import read_pickle [as 别名]
def test_pickle_compat_0_14_1(self, datapath):
hdays = [datetime(2013, 1, 1) for ele in range(4)]
pth = datapath('tseries', 'offsets', 'data', 'cday-0.14.1.pickle')
cday0_14_1 = read_pickle(pth)
cday = CDay(holidays=hdays)
assert cday == cday0_14_1
示例4: load
# 需要导入模块: from pandas.io import pickle [as 别名]
# 或者: from pandas.io.pickle import read_pickle [as 别名]
def load(self, path): # TODO remove in 0.14
"Deprecated. Use read_pickle instead."
import warnings
from pandas.io.pickle import read_pickle
warnings.warn("load is deprecated, use pd.read_pickle", FutureWarning)
return read_pickle(path)