Às 21:10 de 13-04-2016, Paulo da Silva escreveu: > Hi all. ... > [6 rows x 4 columns] > >> dft=pd.DataFrame([[1,2,3,4]], > index=[datetime.date(2016,1,12)],columns=df.columns) > >> dft > A B C D > 2016-01-12 1 2 3 4 > > [1 rows x 4 columns] > >> pd.concat([df,dft]) > Out[71]: > A B C D > 2013-01-01 00:00:00 -0.111621 1.126761 -2.420517 0.660948 > 2013-01-02 00:00:00 -0.243397 -0.975684 -0.679209 -0.656913 > 2013-01-03 00:00:00 0.405816 0.478353 0.621906 -0.262615 > 2013-01-04 00:00:00 -0.380249 0.416711 -0.906286 1.828339 > 2013-01-05 00:00:00 0.772747 0.993784 0.452746 1.665306 > 2013-01-06 00:00:00 0.535011 -0.662874 1.504281 0.543537 > 2016-01-12 1.000000 2.000000 3.000000 4.000000 > > [7 rows x 4 columns] > > Why am I getting the second column?! I need to use for example pd.datetime instead of datetime.date. In fact there is no extra col but the inclusion of hour in the index. Still don't understand why!
> > How do I do to have a row replaced instead of added if its date (index) > is an existent one? df.loc[<the index>]=<the new/replacement list/tuple line> Paulo -- https://mail.python.org/mailman/listinfo/python-list