[Tutor] Adding a new row to the dataframe with datetime as index

Mats Wichmann mats at wichmann.us
Mon May 21 15:36:03 EDT 2018


On 05/21/2018 11:17 AM, Asif Iqbal wrote:

> I want to overwrite the row
> 
>   print ( df.loc['2018-01-24'] )
>   2018-01-24 0.0 1.0 2.0 3.0 4.0 NaN
> 
> 
>   df.loc['2018-01-24'] = [0,1,2,3,4,5]
>   ValueError: cannot set using a list-like indexer with a different length
> than the value

given what you have reported above, your current entry contains the
date, so a list of seven entries; you're trying to replace it with a
list of six entries, so the error seems as expected.


More information about the Tutor mailing list