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

Function test_select_with_dups

pandas/tests/io/pytables/test_select.py:57–76  ·  view source on GitHub ↗
(temp_hdfstore)

Source from the content-addressed store, hash-verified

55
56
57def test_select_with_dups(temp_hdfstore):
58 # single dtypes
59 df = DataFrame(
60 np.random.default_rng(2).standard_normal((10, 4)), columns=["A", "A", "B", "B"]
61 )
62 df.index = date_range("20130101 9:30", periods=10, freq="min", unit="ns")
63
64 temp_hdfstore.append("df", df)
65
66 result = temp_hdfstore.select("df")
67 expected = df
68 tm.assert_frame_equal(result, expected, by_blocks=True)
69
70 result = temp_hdfstore.select("df", columns=df.columns)
71 expected = df
72 tm.assert_frame_equal(result, expected, by_blocks=True)
73
74 result = temp_hdfstore.select("df", columns=["A"])
75 expected = df.loc[:, ["A"]]
76 tm.assert_frame_equal(result, expected)
77
78
79def test_select_with_dups_across_dtypes(temp_hdfstore):

Callers

nothing calls this directly

Calls 4

DataFrameClass · 0.90
date_rangeFunction · 0.90
appendMethod · 0.45
selectMethod · 0.45

Tested by

no test coverage detected