text_html_output_2.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import plotly.express as px

districts_df = pd.read_csv('../input/learnplatform-covid19-impact-on-digital-learning/districts_info.csv')
products_df = pd.read_csv('../input/learnplatform-covid19-impact-on-digital-learning/products_info.csv')

products_df = products_df[products_df['Sector(s)'].notna()]

products_df['primary_function_main'] = products_df['Primary Essential Function'].apply(lambda x: x.split(' - ')[0] if x == x else x)
products_df['primary_function_sub'] = products_df['Primary Essential Function'].apply(lambda x: x.split(' - ')[1] if x == x else x)
products_df.drop('Primary Essential Function', axis=1, inplace=True)

products_sect = products_df['Sector(s)'].value_counts().reset_index()
products_sect.columns = ['Sector(s)', 'percent']
products_sect['percent'] /= len(products_df)
fig = px.pie(products_sect, names='Sector(s)', values='percent', color_discrete_sequence=px.colors.qualitative.Set3, title='Distribution of Sectors', width=700, height=500)
fig.show()