#-*-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 );