Python data analysis notes in Panda (2)

Source: Internet
Author: User

1 separate mobile phone numbers into carriers, regions and number segments

1  frompandas import read_csv;2 3DF = Read_csv ("H:\\pythoncode\\4.6\\data.csv");4 5              6 #转换成字符数据 easy to use slice7df['Tel'] = df['Tel'].astype (str);8 9 #字符的抽取: Extracting new Columns Slice (START,STOP) based on the location of the beginning and end of the known column dataTen #运营商 OneBands = df['Tel'].str.slice (0,3); A #地区 -Areas = df['Tel'].str.slice (3,7); - #号码段 theNums = df['Tel'].str.slice (7, One);

2 look at each table below

(1) DF

(2) Bands

(3) Area

(4) Nums

Python data analysis notes in Panda (2)

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.