Skip to content Skip to sidebar Skip to footer

How To Set A Cell Value In A Multi Header/multi Index Pandas Dataframe

I have a Dataframe that looks like that: SPY Open High Low Close Bid As

Solution 1:

  • Use a tuple to get at the MultiIndex element
  • .ix has been deprecated. In this case, use .at. .loc would also work, but .at is more efficient if getting at a particular cell.

df.at['2010-01-04', ('SPY', 'Open', 'Bid')] = 10

Post a Comment for "How To Set A Cell Value In A Multi Header/multi Index Pandas Dataframe"