发布日期: 2019-06-10 10:07:06 浏览量: 428
star star star star star star star star star star_border

1 Project Overview

1.1 Project Description

Based on pandas and dash,design and implement a Dashboard for a dataset.

1.2 Project function requirements

The dashboard should contain at least three graphs (e.g. scatter plot, bar chart, pie chart, line chart, etc) which reveal certain information respectively

  • It’s not necessary to visualize all the columns/rows of the dataset. You can choose only several of them.

  • An example

2 Design and implementation

2.1 Design

2.1.1 the file directory structure :

  1. ├── datasets
  2. └── BlackFriday.csv
  3. ├── Data Visualization.py
  4. └── readme

2.1.2 Data analysis and processing

Describe a data analysis task for the dataset

(objectives, characteristics of the dataset, etc);


It mainly analyzes and processes the user information in the dataset, analyzes the distribution information of the user’s gender, marital status, living city and age, and analyzes the relationship between them.

characteristics of the dataset

The data set has a large amount of data, and the data relating to the user’s information is relatively easy to quantify. However, due to the large amount of data, it is difficult to describe the data relationship by the distribution of each individual user using the scatter plot. Therefore, the bar chart, the pie chart and the line graph are used to simply describe the distribution of the user on different features.

Describe the layout of designed dashboard and briefly describe the patterns revealed in the figures.

The design of the dashboard is divided into three rows.

Three pie charts are in the first row, which describe the distribution of the user’s gender, marital status, and the type of residential city.

The second row describes the age distribution of the user and the relationship between age and type of city in which they live. Among them, the age distribution can be selected as two description modes, which are a bar chart and a line chart.

The third row describes the relationship between age and years of residence in the current city and the relationship between the number of years of residence in the current city and marital status.

2.2 Implementation

2.2.1 Code implementation

Overall arrangement

  1. app.layout = html.Div([
  2. row1,
  3. row2,
  4. row3,
  5. ])

Callback function of RadioItems

  1. @app.callback(
  2. Output('Age', 'figure'),
  3. [Input('bar_line', 'value')])
  4. def update_graph(bar_line):
  5. if bar_line == 'bar':
  6. return {
  7. 'data': [go.Bar(
  8. x=df['Age'].sort_values().unique(),
  9. y=df['Age'].sort_values().value_counts(),
  10. )],
  11. 'layout': go.Layout(
  12. title='Age',
  13. )
  14. }
  15. elif bar_line == 'line':
  16. return {
  17. 'data': [go.Line(
  18. x=df['Age'].sort_values().unique(),
  19. y=df['Age'].sort_values().value_counts(),
  20. )],
  21. 'layout': go.Layout(
  22. title='Age',
  23. )
  24. }

2.2.2 Interface implementation




3 how to run


Run the Data Visualization.py file to start the server

Start the search engine by typing in the browser.

Select bar or line

Select the mode of the age graph:

上传的附件 cloud_download Data Visualization.zip ( 5.16mb, 0次下载 )
error_outline 下载需要5点积分