Skip to content
Cufflinks
  • AI Chat
  • Code
  • Report
  • import numpy as np
    import matplotlib.pyplot as plt
    import pandas as pd 
    import datetime as dt
    import statsmodels.api as sm
    import seaborn as sns
    import cufflinks as cf
    import plotly.offline as pyo
    import plotly.graph_objs as go
    cf.go_offline()
    df = pd.read_csv('OECDBLI2017.csv')
    df.head()
    df.set_index('Country')['Employment rate as pct'].sort_values(ascending=False).iplot(kind='bar')
    df.iplot(kind='scatter',
    x='Labour market insecurity as pct',
    y='Employment rate as pct',
    mode='markers',
             	xTitle='Labour market insecurity as pct',
    yTitle='Employment rate as pct',
    text='Country')
    df['Water quality as pct'].iplot(kind='hist')
    df.iplot(kind='bubble',
             x='Air pollution in ugm3',
             y='Water quality as pct',
             size='Household net financial wealth in usd',
            title='Zanieczyszczenie powietrza oraz jakość wody w porównaniu do zamożności gospodarstwa domowego',
            text='Country')
    df2 = pd.DataFrame({'x':[1,2,3,4,5],'y':[10,20,30,20,10],'z':[5,4,3,2,1]})
    df2.iplot(kind='surface',colorscale='rdylbu')
    import plotly.offline as pyo
    import plotly.graph_objs as go
    trace0 = go.Scatter(x=df['Labour market insecurity as pct'],
                       y=df['Employment rate as pct'],
                       mode='markers',
                       marker=dict(
                               size=15,
                               color='rgb(10, 166, 106)'),
                      text=df['Country'])
    data = [trace0]
    layout = go.Layout(title='Labour market insecurity vs Employment rate',
                      xaxis=dict(title='Labour market insecurity'),
                      yaxis=dict(title='Employment rate'),
                      hovermode='closest')
    pyo.plot(go.Figure(data= data,layout=layout),filename='labour_scatter.html')
    x = np.arange(1900,2021)
    y = np.random.randint(1000,2000,len(x))
    y2 = np.random.randint(500,1000,len(x))