Python pandas several methods for obtaining column data and comparison of writing forms

Source: Internet
Author: User

Pandas get column data bits common functions, but there are some things to note in the wording, here to summarize:

Import Pandas as Pddata1 = PD. DataFrame (...) #任意初始化一个列数为3的DataFramedata1. columns=[' A ', ' B ', ' C ']1.data1[' B '] #这里取到第2列 (i.e. column B), the value of the 2.data1.b# effect is the same as 1, Take the 2nd column (that is, column B) #这里b为列名称, but must be a contiguous string and cannot have spaces. If there is a space, only the 1th method of 1.data1[5:10] #这里取6到11行的所有数据, instead of the column data 2.data_raw_by_tick[2] #非法, return "Keyerror:2"


This article is from the "Full Stack blog" blog, be sure to keep this source http://reboot001.blog.51cto.com/10869138/1729354

Python pandas several methods for obtaining column data and comparison of writing forms

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.