Using Python data to analyze the series of Panda Learning notes

Source: Internet
Author: User

1 Series

  A: Objects that resemble one-dimensional arrays, each of which is composed of data labels associated with them

 B: The left side of the build is indexed, and the default is 0.

1  from Pandas import Series,dataframe 2  as PD 3  4 obj=series ([4,7,-5,3])5 obj# Index on left value on right

C: You can get the representation of an array and the indexed object by using the values and index properties

1 4,  7,-5,  3], dtype=Int64)2 obj.index

d: Set index values

1 obj2=series ([4,7,-5,3],index=['d', ' b ','a','C'])2  obj23 obj2.index

e: Value is worth by index

1 obj2['a']2 obj2[['C','  a','d']]3 obj2[obj2>0 ]

F: If the data is in a Python dictionary, the series can be created directly from the dictionary

1 sdata={' ohio':35000,'Texas':71000 ,'Oregon':16000,'Utah':  2 obj3=Series (sdata)3 obj3

A very important feature in G:series is that it automatically matches the same index when multiple series operations are performed

1 #如果数据在Python字典中 can create a series directly from this dictionary.2sdata={'Ohio':35000,'Texas':7100,'Oregon': the,'Utah': the}3obj3=Series (sdata)4 obj35 6 #如果只是传入一个字典 The index in the result series is the dictionary key missing as Nan7states=['California','Ohio','Oregon','Texas']8Obj4=series (sdata,index=states)9 Ten #使用isnull notnull Judging missing values One  A  - #Series中一个非常重要的功能就是在算数运算中自动对其不同索引得数据 - obj3 the Obj4 -Obj3+obj4

   

 There is a special attribute in H:series Name property

1 bj4.name='population'2 obj4.index.name=' State ' 3 OB

Using Python data to analyze the series of Panda Learning notes

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.