Big Data Statistics notes

Source: Internet
Author: User
#-*-Coding: UTF-8-*-import pandas as pdimport numpy as npimport matplotlib. pyplot as pltimport jsons = PD. series ([1, 3, 5, NP. nan, 6, 8]); print (s); s = PD. series ([1, 3], ["A", "B"]); print (s); # cyclically query data within the date range dates = PD. date_range ('20140901', periods = 6); print (dates); df = PD. dataframe (NP. random. randn (6, 4), Index = dates, columns = List ('abcd') print ("Limit: ============ "); print (DF. head (3); print (DF. tail (3); print ("reverse XY Display: = "); print (DF. t); # Sort # DF. sort_index (axis = 1, ascending = false) # DF. sort (columns = 'B ') ############### ############# print ("specified column: = "); print (DF [['A', 'B']); print (" DF [row range, column range]: Print (DF [0: 3]); print ("specify the index primary key: = "); print (DF ['000000': '000000']); print (" Boolean filter: ============== "); print (DF [DF. a> 0.5]); # print (DF [,]); ######################## ### Array Operations ############################## print ("Array Operations: ============ "); print (DF * 2); print (NP. exp (DF )); ######################## table elements ############## ############### display in a two-dimensional array # DF. values # column description # DF. columns # index # DF. index # object type # DF. dtypesprint ("Dictionary (JSON) Conversion array: =============="); sdata = {'hio': 35000, 'texas ': 71000, 'oregon': 16000, 'utah': 5000}; df = PD. series (sdata); print (DF); sdata = [{'hio': 35000, 'texas ': 71000,' or Egon ': 16000, 'utah': 5000}]; df = PD. dataframe (sdata); df. columns = ['ohio', 'texas ', 'oregon', 'utah']; print (DF); df = DF. fillna (0) # Replace all missing values with 0 # Getting started # complete /? Cat = 22 # optimized # http://1.aisensiy.sinaapp.com/2014/03/%E6%9C%80%E8%BF%91%E4%BD%BF%E7%94%A8-pandas-%E7%9A%84%E6%80%BB%E7%BB%93/df.to_csv ('e: \ py \ foo.csv ') ###################### JSON ################# ######### print ("josn =========================== "); j = [{'0': {"A": "A"}, '1': {"B": "B"}]; elevations = JSON. dumps (j); df = PD. read_json (elevations); print (DF );

 

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.