-
大小: 19.53MB文件類型: .rar金幣: 2下載: 1 次發(fā)布日期: 2023-07-21
- 語(yǔ)言: Python
- 標(biāo)簽: python??大數(shù)據(jù)??聚類??分類??預(yù)測(cè)??
資源簡(jiǎn)介
航空公司客戶價(jià)值大數(shù)據(jù)分析全部的源代碼,使用python編寫,含數(shù)據(jù)部分
代碼片段和文件信息
#-*-?coding:?utf-8?-*-?
#對(duì)數(shù)據(jù)進(jìn)行基本的探索
#返回缺失值個(gè)數(shù)以及最大最小值
import?pandas?as?pd
datafile=?‘../data/air_data.csv‘?#航空原始數(shù)據(jù)第一行為屬性標(biāo)簽
resultfile?=?‘../tmp/explore.xls‘?#數(shù)據(jù)探索結(jié)果表
data?=?pd.read_csv(datafile?encoding?=?‘utf-8‘)?#讀取原始數(shù)據(jù),指定UTF-8編碼(需要用文本編輯器將數(shù)據(jù)裝換為UTF-8編碼)
explore?=?data.describe(percentiles?=?[]?include?=?‘a(chǎn)ll‘).T?#包括對(duì)數(shù)據(jù)的基本描述,percentiles參數(shù)是指定計(jì)算多少的分位數(shù)表(如1/4分位數(shù)、中位數(shù)等);T是轉(zhuǎn)置,轉(zhuǎn)置后更方便查閱
explore[‘null‘]?=?len(data)-explore[‘count‘]?#describe()函數(shù)自動(dòng)計(jì)算非空值數(shù),需要手動(dòng)計(jì)算空值數(shù)
explore?=?explore[[‘null‘?‘max‘?‘min‘]]
explore.columns?=?[u‘空值數(shù)‘?u‘最大值‘?u‘最小值‘]?#表頭重命名
‘‘‘這里只選取部分探索結(jié)果。
describe()函數(shù)自動(dòng)計(jì)算的字段有count(非空值數(shù))、unique(唯一值數(shù))、top(頻數(shù)最高者)、freq(最高頻數(shù))、mean(平均值)、std(方差)、min(最小值)、50%(中位數(shù))、max(最大值)‘‘‘
explore.to_excel(resultfile)?#導(dǎo)出結(jié)果
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????1221??2018-07-29?17:49??chapter7\demo\code\7-1_data_explore.py
?????文件????????849??2018-07-29?17:49??chapter7\demo\code\7-2_data_clean.py
?????文件????????555??2018-07-29?17:49??chapter7\demo\code\7-3_zscore_data.py
?????文件????????606??2018-07-29?17:49??chapter7\demo\code\7-4_KMeans_cluster.py
?????文件???14478308??2018-07-29?18:18??chapter7\demo\data\air_data.csv
?????文件????4203008??2018-07-29?18:18??chapter7\demo\data\zscoredata.xls
?????文件????6883328??2018-07-29?18:18??chapter7\demo\data\zscoreddata.xls
?????文件??????29696??2018-07-29?17:49??chapter7\demo\data\客戶信息屬性說(shuō)明.xls
?????文件???????9728??2018-07-29?17:49??chapter7\demo\tmp\explore.xls
?????文件????6883328??2018-07-29?18:18??chapter7\demo\tmp\zscoreddata.xls
?????文件????????877??2018-07-29?17:49??chapter7\test\code\cluster_plot.py
?????文件????????849??2018-07-29?17:49??chapter7\test\code\data_clean.py
?????文件???????1221??2018-07-29?17:49??chapter7\test\code\data_explore.py
?????文件????????606??2018-07-29?17:49??chapter7\test\code\KMeans_cluster.py
?????文件????????555??2018-07-29?17:49??chapter7\test\code\zscore_data.py
?????文件???16496640??2018-07-29?18:17??chapter7\test\data\preprocesseddata.xls
?????文件????8340992??2018-07-29?18:17??chapter7\test\data\princompdata.xls
?????文件????4203008??2018-07-29?18:18??chapter7\test\data\zscoredata.xls
?????文件???14175130??2018-07-29?18:17??chapter7\拓展思考\拓展思考樣本數(shù)據(jù).csv
?????目錄??????????0??2018-07-29?17:49??chapter7\demo\code
?????目錄??????????0??2018-07-29?18:18??chapter7\demo\data
?????目錄??????????0??2018-07-29?18:18??chapter7\demo\tmp
?????目錄??????????0??2018-07-29?17:49??chapter7\test\code
?????目錄??????????0??2018-07-29?18:18??chapter7\test\data
?????目錄??????????0??2018-07-29?18:17??chapter7\test\tmp
?????目錄??????????0??2018-07-29?17:49??chapter7\demo
?????目錄??????????0??2018-07-29?18:17??chapter7\test
?????目錄??????????0??2018-07-29?18:17??chapter7\拓展思考
?????目錄??????????0??2018-07-29?18:17??chapter7
-----------?---------??----------?-----??----
............此處省略2個(gè)文件信息
評(píng)論
共有 條評(píng)論