1. 程式人生 > >數據分析基礎

數據分析基礎

atp pyplot odin tor gbk tail max numpy 參數

import numpy as np
import pandas as pd
import scipy
import matplotlib.pyplot as plt
‘‘‘數據導入‘‘‘
df = pd.read_csv(rC:\Users\Administrator\Desktop\app01_bgm.csv,encoding=gbk)
print(df.head())#前五行
print(df.tail())#最後五行
print(df.columns[[1,2]])#頭信息
print(df.index)
print(df.T)#數據轉置使用T方法,
print(df.ix[:,
0].head()) print(df.ix[10:20,1])#行索引,列索引 print(df.drop(df.columns[[3]],axis=1))#axis 參數告訴函數到底舍棄列還是行。如果axis等於0,那麽就舍棄行。 print(df.describe())#通過describe屬性,對數據的統計特性進行描述 ‘‘‘ id fen num count 2216.00000 2216.000000 2216.000000 mean 2519.50000 6.755415 618.274819 std 639.84842 0.842402
959.487784 min 1412.00000 1.200000 51.000000 25% 1965.75000 6.200000 112.000000 50% 2519.50000 6.800000 253.000000 75% 3073.25000 7.300000 693.250000 max 3627.00000 9.100000 10112.000000 ‘‘‘

數據分析基礎