Closed
Description
We're working with DataFrames where the columns are MultiIndexed, so e.g. ones that look like this:
pca
pca1 pca2
0 0.754675 1.868685
1 -1.861651 -0.048236
2 -0.797750 0.388400
which one can get through pd.DataFrame(np.random.normal(size=(6,)).reshape((3,2)), columns=pd.MultiIndex.from_product([['pca'], ["pca1", "pca2"]]))
.
We now want to combine several of those to e.g. get this:
pca nmf
pca1 pca2 nmf1 nmf2
0 1.671707 0.452155 1.671707 0.452155
1 0.861315 -0.100849 0.861315 -0.100849
2 1.056616 -0.852532 1.056616 -0.852532
We know that we can do this through e.g. pd.concat([df_pca, df_nmf], axis=1)
. Is there any support for doing the same like this: df["pca"] = df_pca
for some df? We get ValueError: Wrong number of items passed 4, placement implies 1
.
It's really important for us to allow usage like this: df["pca"] = df_pca
and not just through concat.