我有一個來自回傳整數的函式的變數。
我需要從這個整數在我的資料框中創建一個增量列,我該怎么做?
整數示例:201
預期輸出:
| 專賣店 | 新專欄 |
|---|---|
| 馬科斯商店 | 202 |
| 萊斯專賣店 | 203 |
| 卡羅爾商店 | 204 |
| 安娜商店 | 205 |
| 瑪麗亞商店 | 206 |
uj5u.com熱心網友回復:
n = 201
df['New column'] = df.index n 1
輸出:
Stores New column
0 Marcos Store 202
1 Lais Store 203
2 Carol Store 204
3 Ana Store 205
4 Maria Store 206
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/488309.html
上一篇:基于列值組合行
下一篇:如何過濾分組總和
