Data analysis using Python Pandas Fundamentals: Data Conversion

Source: Internet
Author: User


data conversion refers to filtering, cleaning, and other conversion operations on the data.
Remove Duplicate data Repeating rows often appear in the Dataframe, Dataframe provides a duplicated () method to detect whether rows are duplicated, and another drop_duplicates () method to discard duplicate rows:
Duplicated () and Drop_duplicates () methods defaultJudging all Columns, if you do not want to, the collection of incoming columns as a parameter can be specified as a column, for example:
Duplicated () and drop_duplicates () methodsThe default holds the first occurrence of a value, the incoming take_last=true retains the last value:
Data Transformation with mappings
The same effect can be achieved with functions:
Replace value The replace () method is used for substitution:
Replace multiple values at once:
Different substitutions for different values:
dataframe Renaming an axis index To rename a column:
To rename an index:
divide the data into groups:
Detecting and filtering outlier values Suppose you have a set of data:
Find values with absolute value greater than 2:
Find a line with an absolute value greater than 2:
Set the exception value to 0:

Data analysis using Python Pandas Fundamentals: Data Conversion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.