Welcome to the Simplilearn Community

Want to join the rest of our members? Sign up right away!

Sign Up

Data Science with Python | Vivek Shankaran | May 15 - Jun 19

Dear Vivek,
This is question relating to One of the Projects.
Project : COMCAST
Issue : Facing an issue with only one state (Georgia). All others are fine.
I am creating a 'Total' based on the sum of 'Closed' and 'open' issues. In one chart when I show a stacked chart Open + Closed show up correctly for the state 'Georgia'. When I try to show the 'Total' only in a regular bar chart the Georgia total is way less. This is issue is NOT happening for any other state except for Georgia.
Can you please help me?
Attached is
- Powerpoint wiht the screenshots of the issue
- Below is my python code for the relevant two situations

#create new data frame with status and state column
import pandas as pd
df_4 = pd.DataFrame(comcast, columns=['Status','State'])
# add a new column with new status categories
df_4['status_new']=["Open" if i=="Open" or i=="Pending" else "Closed" for i in df_4.Status]
# converting the values of status into columns with dummy values to enable count later on
dummy = pd.get_dummies(df_5['status_new'])
dummy.head(3)
# adding the newly created dummy columns to the existing data frame by creating a new dataframe
df_5a = pd.concat((df_5, dummy), axis = 1)
df_5a.head(3)
# creating a summary of issues per state of open and closed by using group by and sum
df_10 = df_5a.groupby(['State'])[['Closed', 'Open']].sum()
# creating a total column and then sorting based on total
df_10 ['total'] = df_10['Closed'] + df_10 ['Open']
df_10g = df_10.total.sort_values()
plt.rcParams['figure.figsize'] = (10,6)
df_10g.plot.bar(figsize =(20,10), color = 'g')
plt.ylabel("# of complaints")
plt.title("# of Total complaints Received per State")

# creating a stacked bar chart showing per state open and closed issues
%matplotlib inline
plt.rcParams['figure.figsize'] = (10,6)
df_11b = df_5a.groupby(['State'])[['Closed', 'Open']].sum()
df_11b.plot.bar(stacked=True, figsize=(20,10))
plt.ylabel("# of complaints", fontsize = 14)
plt.title("# of complaints Open and Closed per State", fontsize = 14)
plt.legend(loc='best', fontsize = 10)

plt.xticks(fontsize=10)


Thank you
Giri Mathur
 

Attachments

  • Total_error.pdf
    188.6 KB · Views: 4
Hi Kanika,
if you go to 'Self learning' -> scroll down to 'Resources' you can see the Python ebook. Its a zipped file. There is a download button next to it. Are you able to see it? I tried to attach it here, but the individual files are too large.
 
Hi Kanika,
if you go to 'Self learning' -> scroll down to 'Resources' you can see the Python ebook. Its a zipped file. There is a download button next to it. Are you able to see it? I tried to attach it here, but the individual files are too large.
 

Attachments

  • PythoneBook.pdf
    111.1 KB · Views: 8

Harsha Nyapathi

Customer
Customer
Hi Vivek, I have a doubt in the assessment project of Walmart analysis. We are given a date column and I need to map it to holiday names. I have written the following code but its not giving desired output. Please let me know where the error is.

def holiday(row):
if row in list(map(pd.to_datetime,('2010-02-12','2011-02-11','2012-02-10','2013-02-08'))):
return 'Super bowl'
if row in list(map(pd.to_datetime,('2010-09-10','2011-09-09','2012-09-07','2013-09-06'))):
return 'Labour day'
if row in list(map(pd.to_datetime,('2010-11-26','2011-11-25','2012-11-23','2013-11-29'))):
return 'Thanksgiving'
if row in list(map(pd.to_datetime,('2010-12-31','2011-12-30','2012-12-28','2013-12-27'))):
return 'Christmas'

df['Holiday'] = df['Date'].apply(holiday)
 

Harsha Nyapathi

Customer
Customer
Hi, I'm sorry if its already been announced in class and I missed it, but will there be a project mentoring session? Or a particular class where projects are explained and we clear doubts regarding them?
 

Revathi_17

Administrator
Simplilearn Support
Customer
Hi, I'm sorry if its already been announced in class and I missed it, but will there be a project mentoring session? Or a particular class where projects are explained and we clear doubts regarding them?
Hi, Please raise ticket using help & support, Team will assist you.

Please follow the steps below to raise
"Help and support" ticket.
>Login to LMS account,
>Select "help" icon on the top right hand side of the LMS page
>Select any query
>Connect to "Arya" the virtual assistant
>Select "other"
>To raise a ticket select " yes"
 

Ashish Misra 003

Member
Alumni
I need help regarding project submission:
1. What to upload in write up and screenshot.
2.how to convert jupyter notebook into pdf format, I have tried the inbuild covert to pdf of jupyter but it is not working.
 

Revathi_17

Administrator
Simplilearn Support
Customer
Hi, Please raise ticket using help & support, Team will assist you.

Please follow the steps below to raise
"Help and support" ticket.
>Login to LMS account,
>Select "help" icon on the top right hand side of the LMS page
>Select any query
>Connect to "Arya" the virtual assistant
>Select "other"
>To raise a ticket select " yes"

I need help regarding project submission:
1. What to upload in write up and screenshot.
2.how to convert jupyter notebook into pdf format, I have tried the inbuild covert to pdf of jupyter but it is not working.
 
Top