text_plain_output_1.png
from plotly.offline import init_notebook_mode, iplot

import pandas as pd

import plotly.express as px

import plotly.express as px

import plotly.graph_objects as go

df = pd.read_excel('../input/arabic-companies-reviews-for-sentiment-analysis/Arabic_Reviews.xlsx')

df.drop(inplace=True, columns=['Unnamed: 0'])

df.review_description.duplicated().sum()

df.drop(df[df.review_description.duplicated() == True].index, axis=0, inplace=True)

df = df.rename({'rating(1 postive 0 neutral -1 negative': 'label'}, axis=1)

fig = go.Figure(data=[go.Pie(labels=['postive', 'negative', 'neutral'], values=[df.label[df.label == x].count() for x in df.label.unique()], pull=[0, 0.1, 0])])
fig.update_layout(title='Ratings')

df2 = df.copy()
df2.label = df.label.map({0: 'neutral', 1: 'postive', -1: 'negative'})

fig = px.sunburst(df2, path=['company', 'label'], title='Companies and Feedbacks', color_continuous_scale='RdBu', color='label')
fig.update_traces(textinfo='label + percent parent')

for companyName in df.company.unique():
    fig = go.Figure(data=[go.Bar(y=df.label[df['company'] == companyName].value_counts(), x=df.label[df['company'] == companyName].unique())])
    fig.update_layout(title=companyName + ' Ratings')
    iplot(fig)