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

Function test_default_mode

pandas/tests/io/pytables/test_file_handling.py:85–97  ·  view source on GitHub ↗
(temp_h5_path, using_infer_string)

Source from the content-addressed store, hash-verified

83
84
85def test_default_mode(temp_h5_path, using_infer_string):
86 # read_hdf uses default mode
87 df = DataFrame(
88 np.random.default_rng(2).standard_normal((10, 4)),
89 columns=Index(list("ABCD"), dtype=object),
90 index=date_range("2000-01-01", periods=10, freq="B"),
91 )
92 df.to_hdf(temp_h5_path, key="df", mode="w")
93 result = read_hdf(temp_h5_path, "df")
94 expected = df.copy()
95 if using_infer_string:
96 expected.columns = expected.columns.astype("str")
97 tm.assert_frame_equal(result, expected)
98
99
100def test_reopen_handle(temp_h5_path):

Callers

nothing calls this directly

Calls 7

DataFrameClass · 0.90
IndexClass · 0.90
date_rangeFunction · 0.90
read_hdfFunction · 0.90
to_hdfMethod · 0.80
copyMethod · 0.45
astypeMethod · 0.45

Tested by

no test coverage detected