MCPcopy
hub / github.com/pandas-dev/pandas / setup

Method setup

asv_bench/benchmarks/io/hdf.py:15–55  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

13
14class HDFStoreDataFrame(BaseIO):
15 def setup(self):
16 N = 25000
17 index = Index([f"i-{i}" for i in range(N)], dtype=object)
18 self.df = DataFrame(
19 {"float1": np.random.randn(N), "float2": np.random.randn(N)}, index=index
20 )
21 self.df_mixed = DataFrame(
22 {
23 "float1": np.random.randn(N),
24 "float2": np.random.randn(N),
25 "string1": ["foo"] * N,
26 "bool1": [True] * N,
27 "int1": np.random.randint(0, N, size=N),
28 },
29 index=index,
30 )
31 self.df_wide = DataFrame(np.random.randn(N, 100))
32 self.start_wide = self.df_wide.index[10000]
33 self.stop_wide = self.df_wide.index[15000]
34 self.df2 = DataFrame(
35 {"float1": np.random.randn(N), "float2": np.random.randn(N)},
36 index=date_range("1/1/2000", periods=N),
37 )
38 self.start = self.df2.index[10000]
39 self.stop = self.df2.index[15000]
40 self.df_wide2 = DataFrame(
41 np.random.randn(N, 100), index=date_range("1/1/2000", periods=N)
42 )
43 self.df_dc = DataFrame(
44 np.random.randn(N, 10), columns=[f"C{i:03d}" for i in range(10)]
45 )
46
47 self.fname = "__test__.h5"
48
49 self.store = HDFStore(self.fname)
50 self.store.put("fixed", self.df)
51 self.store.put("fixed_mixed", self.df_mixed)
52 self.store.append("table", self.df2)
53 self.store.append("table_mixed", self.df_mixed)
54 self.store.append("table_wide", self.df_wide)
55 self.store.append("table_wide2", self.df_wide2)
56
57 def teardown(self):
58 self.store.close()

Callers

nothing calls this directly

Calls 6

IndexClass · 0.90
DataFrameClass · 0.90
date_rangeFunction · 0.90
HDFStoreClass · 0.90
putMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected