在Python 2.7.11 + Pandas 0.14.1中,使用datetime64 [ns]列的放大分配似乎会破坏现有列。任何人都可以解释这里发生的事情?谢谢。
import pandas as pd
import numpy as np
ss=pd.Series(data=['1/1/2000','1/2/2000','1/3/2000','1/4/2000','1/5/2000','1/6/2000'])
df = pd.DataFrame(data=np.random.random((6,2)))
print df
0 1
0 0.176862 0.234371
1 0.335773 0.885695
2 0.186647 0.205853
3 0.362603 0.702148
4 0.649333 0.017222
5 0.161256 0.705346
sss = pd.to_datetime(ss)
print sss
df.loc[:,'date'] = sss
print df
0 1 date
0 1970-01-01 1970-01-01 2000-01-01
1 1970-01-01 1970-01-01 2000-01-02
2 1970-01-01 1970-01-01 2000-01-03
3 1970-01-01 1970-01-01 2000-01-04
4 1970-01-01 1970-01-01 2000-01-05
5 1970-01-01 1970-01-01 2000-01-06