小编Cyb*_*ube的帖子

插入空白行熊猫数据框

我有一个名为“因子”的列,每次该列中的名称更改时,我想插入一个空白行,这可能吗?

for i in range(0, end):
    if df2.at[i + 1, 'factor'] != df2.at[i, 'factor']:
Run Code Online (Sandbox Code Playgroud)

python dataframe python-3.x pandas

4
推荐指数
1
解决办法
5496
查看次数

如何在句子的熊猫列中使用自动更正

我有句列,对此我像这样分割

df['ColTest'] = df['ColTest'].str.lower().str.split()
Run Code Online (Sandbox Code Playgroud)

我所试图做的是通过在每个句子每个单词回路和应用autocorrect.spell()

for i in df['ColTest']:
for j in i:
    df['ColTest'][i][j].replace(at.spell(j))
Run Code Online (Sandbox Code Playgroud)

这是扔了一个错误

AttributeError:“ float”对象没有属性“ replace”

autospell autospell

数据框的样子

ColTest
This is some test string
that might contain a finger
but this string might contain a toe
and this hass a spel error
Run Code Online (Sandbox Code Playgroud)

有在我的专栏没有数字...任何想法吗?

python string autocorrect python-3.x pandas

2
推荐指数
1
解决办法
942
查看次数

标签 统计

pandas ×2

python ×2

python-3.x ×2

autocorrect ×1

dataframe ×1

string ×1