<jupyter_start><jupyter_text>Prepared by <NAME>    Data Visualization With Plotly (Part - 1)<jupyter_code>import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.offline as po
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import matplotlib.pyplot as plt
import dash
import plotly.express as px
import random
import plotly.figure_factory as ff<jupyter_output><empty_output><jupyter_text>Loading Datasets<jupyter_code>pokemon = pd.read_csv("C:/Users/DELL/Documents/GitHub/Public/Data-Visualization/Plotly/Datasets/pokemon_updated.csv")
pokemon.head(10)
stdperf = pd.read_csv("C:/Users/DELL/Documents/GitHub/Public/Data-Visualization/Plotly/Datasets/studentp.csv")
stdperf.head(10)
corona = pd.read_csv('C:/Users/DELL/Documents/GitHub/Public/COVID-19/covid/data/countries-aggregated.csv' ,
                     index_col='Date' , parse_dates=True)
corona.head(10)
spotify = pd.read_csv("C:/Users/DELL/Documents/GitHub/Public/Data-Visualization/Plotly/Datasets/spotify.csv" , index_col="Date")
spotify.head(10)
housing = pd.read_csv('C:/Users/DELL/Documents/GitHub/Data-Visualization/housing.csv')
housing.tail()
insurance = pd.read_csv('C:/Users/DELL/Documents/GitHub/Data-Visualization/insurance.csv')
insurance.head(10)
employment = pd.read_excel("C:/Users/DELL/Documents/GitHub/Public/Data-Visualization/Plotly/Datasets/unemployment.xlsx")
employment.head(10)
helpdesk = pd.read_csv("C:/Users/DELL/Documents/GitHub/Public/Data-Visualization/Plotly/Datasets/helpdesk.csv")
helpdesk.head(10)
fish= pd.read_csv("C:/Users/DELL/Documents/GitHub/Public/Data-Visualization/Plotly/Datasets/Fish.csv")
fish.head(10)
exercise = pd.read_csv("C:/Users/DELL/Documents/GitHub/Public/Data-Visualization/Plotly/Datasets/exercise.csv")
exercise.head(10)
suicide = pd.read_csv("C:/Users/DELL/Documents/GitHub/Public/Data-Visualization/Plotly/Datasets/suicide.csv") 
suicide.head(10)
canada = pd.read_csv("C:/Users/DELL/Documents/GitHub/Public/Data-Visualization/Plotly/Datasets/canada.csv")
canada.head()
canada.columns
canada.drop(columns=['AREA' , 'DEV', 'DevName' , 'REG', 'Type', 'Coverage' , 'AreaName', 'RegName' ], inplace=True)
canada.head()
canada.rename(columns={'OdName':'Country'} , inplace=True)
canada.set_index(canada.Country,inplace=True)
canada.head()
canada2 = canada.copy()
canada2.head()
canada.index.name=None
canada.head()
del canada['Country']
canada.head()
canada = canada.transpose()
canada.head()<jupyter_output><empty_output><jupyter_text>Sunburst Chart<jupyter_code>insurance = pd.read_csv('C:/Users/DELL/Documents/GitHub/Data-Visualization/insurance.csv')
insurance.head(10)
# Simple Sunburst Chart

fig = px.sunburst(insurance, path=['region', 'smoker' , 'sex'], values='charges')
fig.update_layout (height = 800 , width = 800)
fig.show()
fig = px.sunburst(insurance, path=['region', 'smoker' , 'sex'], values='charges' , color= 'charges')
fig.update_layout (height = 800 , width = 800)
fig.show()
# Using inbuilt color scales in Sunburst Chart

fig = px.sunburst(
                   insurance,
                   path=['region', 'smoker' , 'sex'], 
                   values='charges' , color= 'charges' , 
                   color_continuous_scale=px.colors.sequential.Aggrnyl
                 )

fig.update_layout (height = 800 , width = 800)
fig.show()
# Using color scales in Sunburst Chart

fig = px.sunburst(
                   insurance, 
                   path=['region', 'smoker' , 'sex'], 
                   values='charges' , 
                   color= 'charges' , 
                   color_continuous_scale=["#8BC34A", "#FF6F00"] #Explicitly Constructing a Color Sequence
                  )

fig.update_layout (height = 800 , width = 800)
fig.show()
# Using color scales in Sunburst Chart

fig = px.sunburst(
                   insurance, 
                   path=['region', 'smoker' , 'sex'], 
                   values='charges' , color= 'charges' , 
                   color_continuous_scale=["#689F38","#F9A825", "#FF6F00"] #Explicitly Constructing a Color Sequence
                  )

#Controlling text fontsize with uniformtext
fig.update_layout (height = 800 , width = 800 , uniformtext=dict(minsize=14, mode='hide'))
fig.show()
suicide.head(10)
fig = px.sunburst(suicide, path=['sex', 'age' , 'generation'], values='suicides_no')
fig.update_layout (height = 900 , width = 900)
fig.show()
fig = px.sunburst(
                   suicide, path=['sex', 'age' , 'generation'], 
                   values='suicides_no' , 
                   color= 'suicides_no' , 
                   color_continuous_scale=["#8BC34A","#FF6F00"]
                 )

fig.update_layout (height = 900 , width = 900)
fig.show()<jupyter_output><empty_output>