Prerequisites:
Familiarity with cognitive new programming tools (Jupyter Notebook)
1, installation: The use of PIP to install Jupyter. Enter the installation command PIP install Jupyter can be;
2, start: After the installation is complete, we can find Jupyter-notebook This application in the following directory; double-click Start
As shown in the following:
3. Open the browser compiler
The programming tool is ready to complete.
Practical Data Visualization Tutorial:
Import Pymongo Import Charts
client = Pymongo. Mongoclient ( ' localhost " , 27017) Ceshi = Client[ ceshi " ]item_info = Ceshi[ " item_info Span style= "COLOR: #800000" > ' ]
for i in item_info.find (). Limit (300< Span style= "color: #000000"): if i[ area ' ] = = [ " ": pass else : print (I[" area ' ])
area_list = [] for i in item_info.find (). Limit (300 if i[ " area "] = = [" ]: pass else : Area_list.append (i[ " area "][1]) Area_index = list (set (area_list)) print (Area_index)
Post_times = [] for in area_index: post_times.append (Area_list.count (index)) Print(post_times)
Data_gen ('column')
defData_gen (types): Length=0ifLength <=Len (area_index): forArea,timesinchZip (area_index,post_times): Data= { 'name': Area,'Data': [Times],'type': Types}yieldData Length+ = 1
for in Data_gen ('column'): print(i)
for in Data_gen ('column')]charts.plot (series,show=' ) inline ', Options=dict (title=dict (text=' Hangzhou Post Data statistics- Wang ')))
Final Run Result:
Summarize the points of knowledge:
1, the introduction and use of charts module;
2, the list of append () function use;
3, COUNT () function use;
4, the use of Set function sets ();
5, the use of list analytic type;
6, the use of the zip () function;
7, the use of yield generator;
8, MongoDB database operation use;
Data Visualization-Python