The road of Mathematics-python Data Processing (1)

Source: Internet
Author: User

Pandas Foundation

Import Pandas ASPD

Import NumPy as NP

#数字序列

MYSERIES=PD. Series ([1,3,5,np.nan,6,8])

Print Myseries

#日期序列

Mydate=pd.date_range (' 20150101 ', periods=42)

Print MyDate

Generating sequences

The results are as follows:

0 1

1 3

2 5

3 NaN

4 6

5 8

Dtype:float64

<class ' Pandas.tseries.index.DatetimeIndex ' >

[2015-01-01, ..., 2015-02-11]

Length:42, Freq:d, Timezone:none

To generate a data set

This blog all content is original, if reproduced please indicate source http://blog.csdn.net/myhaspl/

#-*-Coding:utf-8-*-

"""

Created on Mon Mar 09 11:21:02 2015

@author: [Email protected]

"""

Print U "python data analysis \ n"

Import Pandas as PD

Import NumPy as NP

#日期序列

Mydate=pd.date_range (' 20150101 ', periods=10)

Print MyDate

#构造商品销量数据

MYDF =PD. DataFrame (Np.random.randint (0,1000,size= (10,4)), Index=mydate,columns=[u ' Commodity a ', U ' goods b ', U ' commodity c ', U ' commodity d ')

#输出商品销量数据

Print MYDF

The results of the operation are as follows:

Runfile (' c:/users/administrator/desktop/test1.py ', wdir=r ' c:/users/administrator/desktop ')

Python Data analysis

<class ' Pandas.tseries.index.DatetimeIndex ' >

[2015-01-01, ..., 2015-01-10]

Length:10, Freq:d, Timezone:none

Commodity a commodity B commodity C commodity D

2015-01-01 369 836 908 440

2015-01-02 257 26 725 542

2015-01-03 485 694 701 172

2015-01-04 468 762 536 735

2015-01-05 828 996 852 267

2015-01-06 690 824 515 749

2015-01-07 357 740 559 157

2015-01-08 705 573 193 568

2015-01-09 285 853 600 132

2015-01-10 681 437 935 93

The road of Mathematics-python Data Processing (1)

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.