Skip to content

value assignment bug for multi-indexed dataframes in v1.0.0rc0 #30892

Closed
@leo4183

Description

@leo4183

Problem Description

in new pre-release 1.0.0.rc0, sliced value assignment for multi-indexed dataframe with duplicated datetime indices would fail

import pandas as pd
x = pd.DataFrame([[1,2,3],['a','a','c']],index=['c1','index2'],
                 columns=pd.to_datetime(['20190101','20190101','20190102'])).T
x['c2'] = np.nan
x.index.name = 'index1'
x.set_index(['index2'],append=True,inplace=True)


In [0]: x
Out[0]:
                 c1  c2
index1   index2       
20190101 a       1  NaN
         a       2  NaN
20190102 c       3  NaN


x.loc[(pd.to_datetime('20190101'),'a'),'c2'] = 1.0     # ok
x.loc[[(pd.to_datetime('20190101'),'a')],'c2'] = 1.0   # ValueError

Metadata

Metadata

Assignees

No one assigned

    Labels

    IndexingRelated to indexing on series/frames, not to indexes themselvesRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions