forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsgpack.py
32 lines (23 loc) · 826 Bytes
/
msgpack.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import warnings
import numpy as np
from pandas import DataFrame, date_range, read_msgpack
import pandas.util.testing as tm
from ..pandas_vb_common import BaseIO
class MSGPack(BaseIO):
def setup(self):
self.fname = "__test__.msg"
N = 100000
C = 5
self.df = DataFrame(
np.random.randn(N, C),
columns=["float{}".format(i) for i in range(C)],
index=date_range("20000101", periods=N, freq="H"),
)
self.df["object"] = tm.makeStringIndex(N)
with warnings.catch_warnings(record=True):
self.df.to_msgpack(self.fname)
def time_read_msgpack(self):
read_msgpack(self.fname)
def time_write_msgpack(self):
self.df.to_msgpack(self.fname)
from ..pandas_vb_common import setup # noqa: F401 isort:skip