Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python中的重复数据消除-如何使脚本自动运行?_Python_Pandas - Fatal编程技术网

Python中的重复数据消除-如何使脚本自动运行?

Python中的重复数据消除-如何使脚本自动运行?,python,pandas,Python,Pandas,我试图在一个包含10000行的大型excel电子表格中删除一些数据 这是我的脚本: import pandas as pd import pandas_dedupe df = pd.read_excel('Qualys-Working.xlsx') df_final = pandas_dedupe.dedupe_dataframe(df,['IP','DNS','CONTROL_ID','INSTANCE']) df_final.to_excel('Qualys-TimD-Working-NEW

我试图在一个包含10000行的大型excel电子表格中删除一些数据

这是我的脚本:

import pandas as pd
import pandas_dedupe
df = pd.read_excel('Qualys-Working.xlsx')
df_final = pandas_dedupe.dedupe_dataframe(df,['IP','DNS','CONTROL_ID','INSTANCE'])
df_final.to_excel('Qualys-TimD-Working-NEW.xlsx',index=False)
但当我运行脚本时,它会不断要求我对数据进行选择:

Do these records refer to the same thing?
(y)es / (n)o / (u)nsure / (f)inished / (p)revious
n
IP : 10.0.0.12
DNS : prd-sql-a5
CONTROL_ID : 999999.0
INSTANCE : None

IP : None
DNS : None
CONTROL_ID : None
INSTANCE : None

0/10 positive, 4/10 negative
Do these records refer to the same thing?
(y)es / (n)o / (u)nsure / (f)inished / (p)revious

要在10000行上运行它需要很长时间,我不确定我必须做出的所有选择。如何使其自动运行?

熊猫重复数据消除库的工作原理如下:

  • 将数据集的样本标记为重复或不同的记录
  • 当您标记了足够的记录后,按f键(即完成)
  • “重复数据消除”保存在设置文件中学习的内容(您将看到它们显示在文件夹中)
下次运行pandas Duplicate时,它将自动加载设置文件,并根据学到的内容删除数据

总之,首先您需要教熊猫重复数据消除如何工作;然后它会自动为您完成任务