1
zhusimaji 2019-08-13 14:13:34 +08:00
import pandas as pd
import numpy as np dates=pd.date_range('20130201',periods=6) a=pd.DataFrame(np.arange(24).reshape((6,4)),index=dates,columns=['a','b','c','d']) print(a) a.loc[a['a']==12,'b']=5 print(a) --------------------------------------------------------------------- a b c d 2013-02-01 0 1 2 3 2013-02-02 4 5 6 7 2013-02-03 8 9 10 11 2013-02-04 12 13 14 15 2013-02-05 16 17 18 19 2013-02-06 20 21 22 23 a b c d 2013-02-01 0 1 2 3 2013-02-02 4 5 6 7 2013-02-03 8 9 10 11 2013-02-04 12 5 14 15 2013-02-05 16 17 18 19 2013-02-06 20 21 22 23 |
2
jiang123574 OP @zhusimaji 感谢大佬
|