Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
I create a 1 row dataframe with multiindex
I reindex on a single level, and I expect all values in the new index to be in the new dataframe.
instead, the same dataframe is returned.
the same happens with more than a single row.
If I use a 1d index, or apply to the columns, I get a 100 row/column dataframe as expected
Expected Behavior
expected_output = pd.DataFrame({"a":10, "b": range(100), "c": np.nan}).set_index(["a", "b"])
expected_output.loc[(10,2), "c"]=1
expected_output.head()
# c
# a b
# 10 0 NaN
# 1 NaN
# 2 1.0
# 3 NaN
# 4 NaN
Pandas version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[ ] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
I create a 1 row dataframe with multiindex I reindex on a single level, and I expect all values in the new index to be in the new dataframe. instead, the same dataframe is returned.
the same happens with more than a single row.
If I use a 1d index, or apply to the columns, I get a 100 row/column dataframe as expected
Expected Behavior
Installed Versions