小编nat*_*ath的帖子

过滤 Pandas DataFrame 中给定值在两列值之间的所有行

我已经有了这个包含两列浮点数的数据帧,我想根据这个值 10.9 提取一个数据帧,它不在数据帧上,这样它就会返回 10.9 范围内的数据帧,请看下表

   Words    Start_time(in sec)  End_time(in secs)   Time_per_words
0   let         0.1                 2.5                2.6
1   me          2.5                 2.6                5.1
2   tell        2.6                 2.9                5.5
3   you         2.9                 3.0                5.9
4   about       3.0                 3.2                6.2
5    4          10.7                11.0               21.7
Run Code Online (Sandbox Code Playgroud)

预期结果:当我用 3.10 过滤时,我想在下面得到这个数据框,提前谢谢

   Words    Start_time(in sec)  End_time(in secs)   Time_per_words
4   4           10.7                11.0               21.7
Run Code Online (Sandbox Code Playgroud)

python dataframe pandas

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

如何从python中带有文本和数字的不同元组列表中获取所有字符串

我在从下面的元组列表中获取文本列表时遇到了很大的挑战,这是我从 nltk 库中获取的关键字

[('supreme court justice ruth bader ginsburg may', 14.0),
 ('justice ruth bader ginsburg rightly holds', 12.0),
 ('vintage ruth— ‘ straight ahead', 10.0),
 ('fellow supreme court colleagues penned', 10.0),
 ('could make things better', 8.0),
 ('neighbor sanford greenberg says', 8.0),
 ('live. ” ginsburg ’', 8.0),]
Run Code Online (Sandbox Code Playgroud)

这是我想得到的预期输出

['supreme court justice ruth bader ginsburg may',
 'justice ruth bader ginsburg rightly holds',
 'vintage ruth— ‘ straight ahead',
 'fellow supreme court colleagues penned',
 'could make things better',
 'neighbor sanford greenberg says', 
 'live. ” ginsburg …
Run Code Online (Sandbox Code Playgroud)

python string nlp

0
推荐指数
1
解决办法
27
查看次数

标签 统计

python ×2

dataframe ×1

nlp ×1

pandas ×1

string ×1