Closed
Description
df = pd.DataFrame(
{
"A": ["foo", "bar", "foo", "bar", "foo", "bar", "foo", "foo"],
"B": ["one", "one", "two", "three", "two", "two", "one", "three"],
"C": np.random.randn(8),
"D": np.random.randn(8),
}
)
rng = pd.date_range("2014", periods=len(df))
df.columns.name = "foo"
df.index = rng
g = df.groupby(["A"])[["C"]]
g_exp = df[["C"]].groupby(df["A"])
tm.assert_frame_equal(g.dtypes, g_exp.dtypes)
>>> print(g.dtypes)
foo C
A
bar float64
foo float64
Not clear to me what this is supposed to mean. The example above is from the one test we have (test_groupby_selection_other_methods) that gets here. Shouldn't a user just check df["C"].dtype
in this case?