首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
V2EX
›
问与答
pandas 怎么在函数里,调用当前行索引值?
mfanming
·
2021 年 10 月 13 日
· 967 次点击
这是一个创建于 1553 天前的主题,其中的信息可能已经有所发展或是发生改变。
#函数体
def wordsep(df_word):
df.loc[df_word.index,['主体']] = '' <------------------这一行
return result
#调用
df['分词'] = df.apply(wordsep,axis=1)
wordsep
分词
axis
loc
1 条回复
1
mfanming
OP
2021 年 10 月 13 日
函数里怎么也调不出索引值,目前做法是,生成一列跟索引一样的,感觉好笨的方法
关于
·
帮助文档
·
自助推广系统
·
博客
·
API
·
FAQ
·
Solana
·
974 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 23ms ·
UTC 21:42
·
PVG 05:42
·
LAX 13:42
·
JFK 16:42
♥ Do have faith in what you're doing.
❯