The pandas in Python

Source: Internet
Author: User

1. The most important thing in the pandas library is the variable-length dictionary (series) and the most important function of the series is alignment; that is, an index, a value in the form, as follows:


The series uses PD, which automatically adds an index to each value in the list, or you can specify the index yourself as follows:


I generated the dictionary in the form of a list, as follows:


You can change the format of Dictionary D with series as follows:


In addition, the series can also be added in the following manner as follows:


Index numbers are added together, different return Nan, and automatically align different index numbers

2, the name attribute in the series is also very important


' Order ' is a man-made name, student is the name of the whole M1, so it's efficient to deal with the problem!

3, Dataframe more powerful than series, series can only handle one-to-one, for a pair of more can not deal with, what meaning? As shown in the following:


As shown, for a one-to-many case series will be an error, but the use of dataframe will be handled particularly well!

Next, let's look at some of the basic operations of Dataframe:



The corresponding mapping is output by index. IX, and the elements can be changed;


To delete an operation


Like series, Dataframe can also add the name attribute to the index:


Add x, Y, z through columns



The pandas in Python

Related Article

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.