import pandas as pd import plotly.express as px import plotly.graph_objs as go import plotly.io as pio pio.templates.default = 'plotly_white' data = pd.read_excel("product1.xlsx") data.head() country = pd.DataFrame(data.groupby(['Order_Year','Region','Country','Item Type','Sales Channel'], as_index=False)[['Total Profit','Total Revenue','Total Cost']].sum()) print(country) india= country[country['Region']=="Asia"] online=india[india['Sales Channel']=="Offline"] one=online[online['Order_Year']==2010] chennai= country[country['Region']=="Asia"] mumbai=chennai[chennai['Sales Channel']=="Offline"] two=mumbai[mumbai['Order_Year']==2011] kerala= country[country['Region']=="Asia"] andhra=kerala[kerala['Sales Channel']=="Offline"] three=andhra[andhra['Order_Year']==2012] hamith= country[country['Region']=="Asia"] japan=hamith[hamith['Sales Channel']=="Offline"] four=japan[japan['Order_Year']==2013] basith= country[country['Region']=="Asia"] lukman=basith[basith['Sales Channel']=="Offline"] five=lukman[lukman['Order_Year']==2014] barees= country[country['Region']=="Asia"] meena=barees[barees['Sales Channel']=="Offline"] six=meena[meena['Order_Year']==2015] athif= country[country['Region']=="Asia"] hisham=athif[athif['Sales Channel']=="Offline"] seven=hisham[hisham['Order_Year']==2016] athif= country[country['Region']=="Asia"] hisham=athif[athif['Sales Channel']=="Offline"] seven=hisham[hisham['Order_Year']==2016] mufith= country[country['Region']=="Asia"] bahad=mufith[mufith['Sales Channel']=="Offline"] eight=bahad[bahad['Order_Year']==2017] fig = go.Figure() fig.add_trace(go.Bar( x=one['Country'], y=one['Total Profit'], name="2010 - Asia", marker_color="red" )) fig.add_trace(go.Bar( x=two['Country'], y=two['Total Profit'], name="2011 - Asia", marker_color="blue" )) fig.add_trace(go.Bar( x=three['Country'], y=three['Total Profit'], name="2012 - Asia", marker_color="green" )) fig.add_trace(go.Bar( x=four['Country'], y=four['Total Profit'], name="2013 - Asia", marker_color="yellow" )) fig.add_trace(go.Bar( x=five['Country'], y=five['Total Profit'], name="2014 - Asia", marker_color="skyblue" )) fig.add_trace(go.Bar( x=six['Country'], y=six['Total Profit'], name="2015 - Asia", marker_color="orange" )) fig.add_trace(go.Bar( x=seven['Country'], y=seven['Total Profit'], name="2016 - Asia", marker_color="pink" )) fig.add_trace(go.Bar( x=eight['Country'], y=eight['Total Profit'], name="2017 - Asia", marker_color="brown" )) fig.update_layout(title_text="Asia countries total profit sale report offline") fig.show() ocean = country[country['Region']=="Australia and Oceania"] ole = ocean[ocean['Sales Channel']=="Offline"] product1 = ole[ole['Order_Year']==2010] ocean = country[country['Region']=="Australia and Oceania"] sakthi = ocean[ocean['Sales Channel']=="Offline"] product2 = sakthi[sakthi['Order_Year']==2011] ocean = country[country['Region']=="Australia and Oceania"] ram = ocean[ocean['Sales Channel']=="Offline"] product3 = ram[ram['Order_Year']==2012] ocean = country[country['Region']=="Australia and Oceania"] rashi = ocean[ocean['Sales Channel']=="Offline"] product4 = rashi[rashi['Order_Year']==2013] ocean = country[country['Region']=="Australia and Oceania"] rishad = ocean[ocean['Sales Channel']=="Offline"] product5 = rishad[rishad['Order_Year']==2014] ocean = country[country['Region']=="Australia and Oceania"] rowdy = ocean[ocean['Sales Channel']=="Offline"] product6 = rowdy[rowdy['Order_Year']==2015] ocean = country[country['Region']=="Australia and Oceania"] ribath = ocean[ocean['Sales Channel']=="Offline"] product7 = ribath[ribath['Order_Year']==2016] ocean = country[country['Region']=="Australia and Oceania"] kashmir= ocean[ocean['Sales Channel']=="Offline"] product8 = kashmir[kashmir['Order_Year']==2017] fig = go.Figure() fig.add_trace(go.Bar( x=product1['Country'], y=product1['Total Profit'], name = "2010 - Australia and Oceania", marker_color = 'red' )) fig.add_trace(go.Bar( x=product2['Country'], y=product2['Total Profit'], name = "2011 - Australia and Oceania", marker_color = 'blue' )) fig.add_trace(go.Bar( x=product3['Country'], y=product3['Total Profit'], name = "2012 - Australia and Oceania", marker_color = 'green' )) fig.add_trace(go.Bar( x=product4['Country'], y=product4['Total Profit'], name = "2013 - Australia and Oceania", marker_color = 'pink' )) fig.add_trace(go.Bar( x=product5['Country'], y=product5['Total Profit'], name = "2014 - Australia and Oceania", marker_color = 'yellow' )) fig.add_trace(go.Bar( x=product6['Country'], y=product6['Total Profit'], name = "2015 - Australia and Oceania", marker_color = 'skyblue' )) fig.add_trace(go.Bar( x=product7['Country'], y=product7['Total Profit'], name = "2016 - Australia and Oceania", marker_color = 'brown' )) fig.add_trace(go.Bar( x=product8['Country'], y=product8['Total Profit'], name = "2017 - Australia and Oceania", marker_color = 'orange' )) fig.update_layout(title_text = "Australia and Oceania total profit of 2010 to 2017 offline") fig.show() ocean = country[country['Region']=="Central America and the Caribbean"] fine1 = ocean[ocean['Sales Channel']=="Offline"] product11 = fine1[fine1['Order_Year']==2010] ocean = country[country['Region']=="Central America and the Caribbean"] fine2 = ocean[ocean['Sales Channel']=="Offline"] product12 = fine2[fine2['Order_Year']==2011] ocean = country[country['Region']=="Central America and the Caribbean"] fine3 = ocean[ocean['Sales Channel']=="Offline"] product13= fine3[fine3['Order_Year']==2012] ocean = country[country['Region']=="Central America and the Caribbean"] fine4 = ocean[ocean['Sales Channel']=="Offline"] product14= fine4[fine4['Order_Year']==2013] ocean = country[country['Region']=="Central America and the Caribbean"] fine5 = ocean[ocean['Sales Channel']=="Offline"] product15= fine5[fine5['Order_Year']==2014] ocean = country[country['Region']=="Central America and the Caribbean"] fine6 = ocean[ocean['Sales Channel']=="Offline"] product16= fine6[fine6['Order_Year']==2015] ocean = country[country['Region']=="Central America and the Caribbean"] fine7 = ocean[ocean['Sales Channel']=="Offline"] product17= fine7[fine7['Order_Year']==2016] ocean = country[country['Region']=="Central America and the Caribbean"] fine8 = ocean[ocean['Sales Channel']=="Offline"] product18= fine8[fine8['Order_Year']==2017] fig = go.Figure() fig.add_trace(go.Bar( x=product11['Country'], y=product11['Total Profit'], name = "2010 - Central America and the Caribbean", marker_color = 'red' )) fig.add_trace(go.Bar( x=product12['Country'], y=product12['Total Profit'], name = "2011 - Central America and the Caribbean", marker_color = 'blue' )) fig.add_trace(go.Bar( x=product13['Country'], y=product13['Total Profit'], name = "2012 - Central America and the Caribbean", marker_color = 'green' )) fig.add_trace(go.Bar( x=product14['Country'], y=product14['Total Profit'], name = "2013 - Central America and the Caribbean", marker_color = 'pink' )) fig.add_trace(go.Bar( x=product15['Country'], y=product15['Total Profit'], name = "2014 - Central America and the Caribbean", marker_color = 'yellow' )) fig.add_trace(go.Bar( x=product16['Country'], y=product16['Total Profit'], name = "2015 - Central America and the Caribbean", marker_color = 'skyblue' )) fig.add_trace(go.Bar( x=product17['Country'], y=product17['Total Profit'], name = "2016 - Central America and the Caribbean", marker_color = 'brown' )) fig.add_trace(go.Bar( x=product18['Country'], y=product18['Total Profit'], name = "2017 - Central America and the Caribbean", marker_color = 'orange' )) fig.update_layout(title_text = "Central America and the Caribbean total profit of 2010 to 2017 offline") fig.show() ocean = country[country['Region']=="Europe"] fine11 = ocean[ocean['Sales Channel']=="Offline"] product21 = fine11[fine11['Order_Year']==2010] ocean = country[country['Region']=="Europe"] fine12 = ocean[ocean['Sales Channel']=="Offline"] product22 = fine12[fine12['Order_Year']==2011] ocean = country[country['Region']=="Europe"] fine13 = ocean[ocean['Sales Channel']=="Offline"] product23 = fine13[fine13['Order_Year']==2012] ocean = country[country['Region']=="Europe"] fine14 = ocean[ocean['Sales Channel']=="Offline"] product24 = fine14[fine14['Order_Year']==2013] ocean = country[country['Region']=="Europe"] fine15 = ocean[ocean['Sales Channel']=="Offline"] product25 = fine15[fine15['Order_Year']==2014] ocean = country[country['Region']=="Europe"] fine16 = ocean[ocean['Sales Channel']=="Offline"] product26 = fine16[fine16['Order_Year']==2015] ocean = country[country['Region']=="Europe"] fine17 = ocean[ocean['Sales Channel']=="Offline"] product27 = fine17[fine17['Order_Year']==2016] ocean = country[country['Region']=="Europe"] fine18 = ocean[ocean['Sales Channel']=="Offline"] product28 = fine18[fine18['Order_Year']==2017] fig = go.Figure() fig.add_trace(go.Bar( x=product21['Country'], y=product21['Total Profit'], name = "2010 - Europe", marker_color = 'red' )) fig.add_trace(go.Bar( x=product22['Country'], y=product22['Total Profit'], name = "2011 - Europe", marker_color = 'blue' )) fig.add_trace(go.Bar( x=product23['Country'], y=product23['Total Profit'], name = "2012 - Europe", marker_color = 'green' )) fig.add_trace(go.Bar( x=product24['Country'], y=product24['Total Profit'], name = "2013 - Europe", marker_color = 'pink' )) fig.add_trace(go.Bar( x=product25['Country'], y=product25['Total Profit'], name = "2014 - Europe", marker_color = 'yellow' )) fig.add_trace(go.Bar( x=product26['Country'], y=product26['Total Profit'], name = "2015 - Europe", marker_color = 'skyblue' )) fig.add_trace(go.Bar( x=product27['Country'], y=product27['Total Profit'], name = "2016 - Europe", marker_color = 'brown' )) fig.add_trace(go.Bar( x=product28['Country'], y=product28['Total Profit'], name = "2017 - Europe", marker_color = 'orange' )) fig.update_layout(title_text = "Europe total profit of 2010 to 2017 offline") fig.show() ocean = country[country['Region']=="Middle East and North Africa"] fine31 = ocean[ocean['Sales Channel']=="Offline"] product31 = fine31[fine31['Order_Year']==2010] ocean = country[country['Region']=="Middle East and North Africa"] fine32 = ocean[ocean['Sales Channel']=="Offline"] product32 = fine32[fine32['Order_Year']==2011] ocean = country[country['Region']=="Middle East and North Africa"] fine33 = ocean[ocean['Sales Channel']=="Offline"] product33 = fine33[fine33['Order_Year']==2012] ocean = country[country['Region']=="Middle East and North Africa"] fine34 = ocean[ocean['Sales Channel']=="Offline"] product34 = fine34[fine34['Order_Year']==2013] ocean = country[country['Region']=="Middle East and North Africa"] fine35 = ocean[ocean['Sales Channel']=="Offline"] product35 = fine35[fine35['Order_Year']==2014] ocean = country[country['Region']=="Middle East and North Africa"] fine36 = ocean[ocean['Sales Channel']=="Offline"] product36 = fine36[fine36['Order_Year']==2015] ocean = country[country['Region']=="Middle East and North Africa"] fine37 = ocean[ocean['Sales Channel']=="Offline"] product37 = fine37[fine37['Order_Year']==2016] ocean = country[country['Region']=="Middle East and North Africa"] fine38 = ocean[ocean['Sales Channel']=="Offline"] product38 = fine38[fine38['Order_Year']==2017] fig = go.Figure() fig.add_trace(go.Bar( x=product31['Country'], y=product31['Total Profit'], name = "2010 - Middle East and North Africa", marker_color = 'red' )) fig.add_trace(go.Bar( x=product32['Country'], y=product32['Total Profit'], name = "2011 - Middle East and North Africa", marker_color = 'blue' )) fig.add_trace(go.Bar( x=product33['Country'], y=product33['Total Profit'], name = "2012 - Middle East and North Africa", marker_color = 'green' )) fig.add_trace(go.Bar( x=product34['Country'], y=product34['Total Profit'], name = "2013 - Middle East and North Africa", marker_color = 'pink' )) fig.add_trace(go.Bar( x=product35['Country'], y=product35['Total Profit'], name = "2014 - Middle East and North Africa", marker_color = 'yellow' )) fig.add_trace(go.Bar( x=product36['Country'], y=product36['Total Profit'], name = "2015 - Middle East and North Africa", marker_color = 'skyblue' )) fig.add_trace(go.Bar( x=product37['Country'], y=product37['Total Profit'], name = "2016 - Middle East and North Africa", marker_color = 'brown' )) fig.add_trace(go.Bar( x=product38['Country'], y=product38['Total Profit'], name = "2017 - Middle East and North Africa", marker_color = 'orange' )) fig.update_layout(title_text = "Middle East and North Africa total profit of 2010 to 2017 offline") fig.show() ocean = country[country['Region']=="North America"] fine41 = ocean[ocean['Sales Channel']=="Offline"] product41 = fine41[fine41['Order_Year']==2010] ocean = country[country['Region']=="North America"] fine42 = ocean[ocean['Sales Channel']=="Offline"] product42 = fine42[fine42['Order_Year']==2011] ocean = country[country['Region']=="North America"] fine43 = ocean[ocean['Sales Channel']=="Offline"] product43 = fine43[fine43['Order_Year']==2012] ocean = country[country['Region']=="North America"] fine44 = ocean[ocean['Sales Channel']=="Offline"] product44 = fine44[fine44['Order_Year']==2013] ocean = country[country['Region']=="North America"] fine45 = ocean[ocean['Sales Channel']=="Offline"] product45 = fine45[fine45['Order_Year']==2014] ocean = country[country['Region']=="North America"] fine46 = ocean[ocean['Sales Channel']=="Offline"] product46 = fine46[fine46['Order_Year']==2015] ocean = country[country['Region']=="North America"] fine47 = ocean[ocean['Sales Channel']=="Offline"] product47 = fine47[fine47['Order_Year']==2016] ocean = country[country['Region']=="North America"] fine48 = ocean[ocean['Sales Channel']=="Offline"] product48= fine48[fine48['Order_Year']==2017] fig = go.Figure() fig.add_trace(go.Bar( x=product41['Country'], y=product41['Total Profit'], name = "2010 - North America", marker_color = 'red' )) fig.add_trace(go.Bar( x=product42['Country'], y=product42['Total Profit'], name = "2011 - North America", marker_color = 'blue' )) fig.add_trace(go.Bar( x=product43['Country'], y=product43['Total Profit'], name = "2012 - North America", marker_color = 'green' )) fig.add_trace(go.Bar( x=product44['Country'], y=product44['Total Profit'], name = "2013 - North America", marker_color = 'pink' )) fig.add_trace(go.Bar( x=product45['Country'], y=product45['Total Profit'], name = "2014 - North America", marker_color = 'yellow' )) fig.add_trace(go.Bar( x=product46['Country'], y=product46['Total Profit'], name = "2015 - North America", marker_color = 'skyblue' )) fig.add_trace(go.Bar( x=product47['Country'], y=product47['Total Profit'], name = "2016 - North America", marker_color = 'brown' )) fig.add_trace(go.Bar( x=product48['Country'], y=product48['Total Profit'], name = "2017 - North America", marker_color = 'orange' )) fig.update_layout(title_text = "North America total profit of 2010 to 2017 offline") fig.show() ocean = country[country['Region']=="Sub-Saharan Africa"] fine51 = ocean[ocean['Sales Channel']=="Offline"] product51 = fine51[fine51['Order_Year']==2010] ocean = country[country['Region']=="Sub-Saharan Africa"] fine52 = ocean[ocean['Sales Channel']=="Offline"] product52 = fine52[fine52['Order_Year']==2011] ocean = country[country['Region']=="Sub-Saharan Africa"] fine53 = ocean[ocean['Sales Channel']=="Offline"] product53 = fine53[fine53['Order_Year']==2012] ocean = country[country['Region']=="Sub-Saharan Africa"] fine54 = ocean[ocean['Sales Channel']=="Offline"] product54 = fine54[fine54['Order_Year']==2013] ocean = country[country['Region']=="Sub-Saharan Africa"] fine55 = ocean[ocean['Sales Channel']=="Offline"] product55 = fine55[fine55['Order_Year']==2014] ocean = country[country['Region']=="Sub-Saharan Africa"] fine56 = ocean[ocean['Sales Channel']=="Offline"] product56 = fine56[fine56['Order_Year']==2015] ocean = country[country['Region']=="Sub-Saharan Africa"] fine57 = ocean[ocean['Sales Channel']=="Offline"] product57 = fine57[fine57['Order_Year']==2016] ocean = country[country['Region']=="Sub-Saharan Africa"] fine58 = ocean[ocean['Sales Channel']=="Offline"] product58 = fine58[fine58['Order_Year']==2017] fig = go.Figure() fig.add_trace(go.Bar( x=product51['Country'], y=product51['Total Profit'], name = "2010 - Sub-Saharan Africa", marker_color = 'red' )) fig.add_trace(go.Bar( x=product52['Country'], y=product52['Total Profit'], name = "2011 - Sub-Saharan Africa", marker_color = 'blue' )) fig.add_trace(go.Bar( x=product53['Country'], y=product53['Total Profit'], name = "2012 - Sub-Saharan Africa", marker_color = 'green' )) fig.add_trace(go.Bar( x=product54['Country'], y=product54['Total Profit'], name = "2013 - Sub-Saharan Africa", marker_color = 'pink' )) fig.add_trace(go.Bar( x=product55['Country'], y=product55['Total Profit'], name = "2014 - Sub-Saharan Africa", marker_color = 'yellow' )) fig.add_trace(go.Bar( x=product56['Country'], y=product56['Total Profit'], name = "2015 - Sub-Saharan Africa", marker_color = 'skyblue' )) fig.add_trace(go.Bar( x=product57['Country'], y=product57['Total Profit'], name = "2016 - Sub-Saharan Africa", marker_color = 'brown' )) fig.add_trace(go.Bar( x=product58['Country'], y=product58['Total Profit'], name = "2017 - Sub-Saharan Africa", marker_color = 'orange' )) fig.update_layout(title_text = "Sub-Saharan Africa total profit of 2010 to 2017 offline") fig.show()