2021
07-09
07-09
python 如何对Series中的每一个数据做运算
问题描述最近~发现对series里的元素操作挺复杂的,用forloop+Series.iloc[i]会发生卡死的状况,那么,lambda是解决办法:error1ratings['timestamp']=ratings['timestamp'].apply(ratings['timestamp'].iloc[i].strftime("%Y-%m-%d%H:%M:%S",ts)foriinrange(len(ratings)))TypeError:'generator'objectisnotcallable用lambda直接apply,就相当于对每一行的每个元素,逐一apply:ratings_sub['timestamp']=rat...
继续阅读 >