[英]iPython:Using Pandas, How do I combine multiple text files to find recurring usernames?
I'm using pandas to count recurring usernames from 2 different large text files.我正在使用 Pandas 来计算来自 2 个不同大文本文件的重复用户名。 How do I get my code to analyze the data from both files at the same time?
如何让我的代码同时分析两个文件中的数据? Right now I have only been able to run one text file so nothing is occurring more than once.
现在我只能运行一个文本文件,所以没有发生多次。
Here is my Code:这是我的代码:
import pandas as pd
fixed_df = pd.read_csv('sample.txt', sep=';', encoding='latin1')
fixed_df['User Name'].value_counts().nsmallest()
Combine files like this合并这样的文件
fixed_df1 = pd.read_csv('sample1.txt', sep=';', encoding='latin1')
fixed_df2 = pd.read_csv('sample2.txt', sep=';', encoding='latin1')
fixed_df = pd.concat([fixed_df1, fixed_df2])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.