首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >循环遍历dataframe,如果获得了所需的值,则将行提取到新的dataframe

循环遍历dataframe,如果获得了所需的值,则将行提取到新的dataframe
EN

Stack Overflow用户
提问于 2018-06-24 17:20:11
回答 3查看 61关注 0票数 0

我想循环遍历数据帧,如果merged_Df$language等于英语、印度尼西亚和苏格兰,我想提取这些数据帧的行,并将其放入另一个新的数据帧中。数据帧如下所示:

代码语言:javascript
运行
复制
   language          text
1|  english      | 11 point agenda of #PTI for upcoming Election. 1-Education 2-Healthcare 3-Tax Reform 4-Corruption Control 5-Economy 6-Employment 7-Tourism 8-Agriculture 9-Federation & Provincial Reform 10-Justice 11-Women Empowerment -- Corrupt Gang #PMLn #MQM #ANP #MMA #JUIF #JI #PPP

2|  indonesian   | @Tadaporn_K <U+0E43><U+0E0A><U+0E48> 555555555 <U+0E41><U+0E15><U+0E48><U+0E15><U+0E2D><U+0E19><U+0E19><U+0E35><U+0E49><U+0E40><U+0E1B><U+0E48><U+0E32><U+0E40><U+0E1B><U+0E32><U+0E21><U+0E32><U+0E41><U+0E23><U+0E07><U+0E21><U+0E32><U+0E01> <U+0E41><U+0E0B

3|  french       | RT @runawaymau: jviens de revoir ça dans ma tl @louehxoioi jui mort

4|  scots        | RT @soloistkji: do they live together or?

5|  spanish      | @Jetzmmt La última vez no pude porque me jui al rancho <U+2639><U+FE0F><f0><U+009F><U+0098><U+0082>

所需的新数据帧为:

代码语言:javascript
运行
复制
   language          text
1|  english      | 11 point agenda of #PTI for upcoming Election. 1-Education 2-Healthcare 3-Tax Reform 4-Corruption Control 5-Economy 6-Employment 7-Tourism 8-Agriculture 9-Federation &amp; Provincial Reform 10-Justice 11-Women Empowerment -- Corrupt Gang #PMLn #MQM #ANP #MMA #JUIF #JI #PPP

2|  indonesian   | @Tadaporn_K <U+0E43><U+0E0A><U+0E48> 555555555 <U+0E41><U+0E15><U+0E48><U+0E15><U+0E2D><U+0E19><U+0E19><U+0E35><U+0E49><U+0E40><U+0E1B><U+0E48><U+0E32><U+0E40><U+0E1B><U+0E32><U+0E21><U+0E32><U+0E41><U+0E23><U+0E07><U+0E21><U+0E32><U+0E01> <U+0E41><U+0E0B
4|  scots        | RT @soloistkji: do they live together or?

如何获得此功能?如何统计每种语言中有多少是英语、印尼语和苏格兰人?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51008533

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档