forked from mariajosecanture/python_project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
48 lines (38 loc) · 1.95 KB
/
Copy pathmain.py
File metadata and controls
48 lines (38 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
# -- --------------------------------------------------------------------------------------------------- -- #
# -- project: A SHORT DESCRIPTION OF THE PROJECT -- #
# -- script: main.py : python script with the main functionality -- #
# -- author: YOUR GITHUB USER NAME -- #
# -- license: GPL-3.0 License -- #
# -- repository: YOUR REPOSITORY URL -- #
# -- --------------------------------------------------------------------------------------------------- -- #
"""
import pandas as pd
import data as dt
# -- TEST 1 :
# verify that the script is being read
print(dt.dict_test)
# -- TEST 2 :
# verify that installed pandas module works correctly
df_dict_test = pd.DataFrame(dt.dict_test, index=[0, 1])
print(df_dict_test)
# -- TEST 3 :
# verify you can use plotly and visualize plots in jupyter notebook
import chart_studio.plotly as py # various tools (jupyter offline print)
import plotly.graph_objects as go # plotting engine
# example data
df = pd.DataFrame({'column_a': [1, 2, 3, 4, 5], 'column_b': [1, 2, 3, 4, 5]})
# basic plotly plot
data = [go.Bar(x=df['column_a'], y=df['column_b'])]
# instruction to view it inside jupyter
py.iplot(data, filename='jupyter-basic_bar')
# (alternatively) instruction to view it in web app of plotly
# py.plot(data)
# -- TEST 4 :
# verify you can use plotly and visualize plots in web browser locally
import plotly.io as pio # to define input-output of plots
pio.renderers.default = "browser" # to render the plot locally in your default web browser
# basic plotly plot
plot_data = go.Figure(go.Bar(x=df['column_a'], y=df['column_b']))
# instruction to view it in specified render (in this case browser)
plot_data.show()