3 回答

TA貢獻2065條經(jīng)驗 獲得超14個贊
DataFrame.apply
一次在整行或列上操作。 DataFrame.applymap
,Series.apply
,和 Series.map
同時對一個元素進行操作。
Series.apply
Series.map

TA貢獻1829條經(jīng)驗 獲得超13個贊
Series
應(yīng)用程序可以使DataFrame從一個系列中提取出來。
In [40]: p=pd.Series([1,2,3])In [41]: pOut[31]:0 11 22 3dtype: int64In [42]: p.apply(lambda x: pd.Series([x, x]))Out[42]: 0 10 1 11 2 22 3 3In [43]: p.map(lambda x: pd.Series([x, x]))Out[43]: 0 0 11 1dtype: int641 0 21 2dtype: int642 0 31 3dtype: int64 dtype: object
apply
series.apply(download_file_for_every_element)
Map
1 2 3 4 52 1 4 5 3
1 2 3 4 51 2 5 3 4
map
0.15.1
.
In [39]: p=pd.Series([1,0,3,4,2])In [40]: p.map(p)Out[40]: 0 01 12 43 24 3dtype: int64
添加回答
舉報