


pandas implements deduplication of duplicate tables and re-converts them into tables
Apr 18, 2018 pm 03:47 PMBelow I will share with you a pandas method to remove duplicate tables and convert them into tables again. It has a good reference value and I hope it will be helpful to everyone. Let’s take a look together
When processing data in python, DataFrame and set are often used.
train=pd.read_csv('XXX.csv')#读取文件 train=train['item_id']#选择要去重的列 train=set(train)#去重 data=pd.DataFrame(list(train),columns=['item_id'])#因为set是无序的,必须要经过list处理后才能成为DataFrame data.to_csv('xxx.csv',index=False)#保存表格
Remember to import pandas~
The above is the detailed content of pandas implements deduplication of duplicate tables and re-converts them into tables. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Steps to adjust the format of pictures inserted in PPT tables

How to make a table for sales forecast

Solving common pandas installation problems: interpretation and solutions to installation errors

How to set WPS value to automatically change color according to conditions_Steps to set WPS table value to automatically change color according to condition

How to read txt file correctly using pandas

Practical tips for reading txt files using pandas

Revealing the efficient data deduplication method in Pandas: Tips for quickly removing duplicate data

How to insert automatic numbering or serial numbers into Word tables
