因为需要一个html形式的数据统计界面,所以做了一个基于pyecharts包的可视化程序,当然matplotlib还是常用的数据可视化包,只不过各有优劣;基本功能概述就是读取csv文件数据,对每列进行数据统计并可视化,最后形成html动态界面,选择pyecharts的最主要原因就是这个动态界面简直非常炫酷。
先上成品图:
数据读取和数据分析模块:
#导入csv模块
import csv
#导入可视化模块
from matplotlib import pyplot as plt
from pylab import mpl
import numpy as np
import random
from pyecharts import Line,Pie,Grid,Bar,WordCloud
#指定文件名,然后使用 with open() as 打开
python_file = 'haiyang.csv'
#filename = 'release/111.csv'
#python3 LieCharts.py test_chart --python_file 'haiyang.csv'
with open(python_file) as f:
#创建一个阅读器:将f传给csv.reader
reader = csv.reader(f)
#使用csv的nex