Skip to content

Instantly share code, notes, and snippets.

@audhiaprilliant
Last active March 7, 2022 00:50
Show Gist options
  • Select an option

  • Save audhiaprilliant/1be30824161fdaec3afe25e264ac2635 to your computer and use it in GitHub Desktop.

Select an option

Save audhiaprilliant/1be30824161fdaec3afe25e264ac2635 to your computer and use it in GitHub Desktop.
Introduction to Plotly
# Data manipulation
import pandas as pd
# Mathematical operation
import numpy as np
# Data viz
import plotly
import plotly.graph_objects as go
from plotly.subplots import make_subplots
# Data set in list of JSON
data = [
{
'Fruit': 'Apples',
'Sales': 15750
},
{
'Fruit': 'Avocados',
'Sales': 10000
},
{
'Fruit': 'Bananas',
'Sales': 25750
},
{
'Fruit': 'Blueberries',
'Sales': 10750
},
{
'Fruit': 'Grapes',
'Sales': 13750
},
{
'Fruit': 'Lemons',
'Sales': 10750
},
{
'Fruit': 'Oranges',
'Sales': 12750
},
{
'Fruit': 'Peaches',
'Sales': 10250
},
{
'Fruit': 'Strawberries',
'Sales': 14500
},
{
'Fruit': 'Watermelon',
'Sales': 12000
}
]
# Convert list of JSON into data frame
df = pd.DataFrame(data)
# Show the dimension of data
print('Dimension of data: {row} rows and {column} columns'.format(
row = len(df),
column = len(df.columns)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment