Answer to Question #310720 in Python for Akash Singh

Question #310720

Problem Statement: You work in XYZ Corporation as a Data Analyst. Your corporation has told you to visualize the mtcars.csv dataset with various plots. 


1. Plot the area chart for the colmns: ‘am’ and ‘carb’.

a. Set the ‘am’ on the x-axis.

b. Set the ‘carb’ on the y-axis.

c. Provide the x-axis label as Transmission.

d. Provide the y-axis labe as Number of carburetors.

e. Provide the title as Transmission vs Number of carburetors.


Problem Statement: You work in XYZ Corporation as a Data Analyst. Your corporation has told you to analyze the customer_churn dataset with various functions.


1. Now from the churn data frame, try to sort the data by the tenure column according to the descending order.

2. Fetch all the records that are satisfying the following condition:

a. Tenure>50 and the gender as ‘Female’.

b. Gender as ‘Male’ and SeniorCitizen as 0.

c. TechSupport as ‘Yes’ and Churn as ‘No’.

d. Contract type as ‘Month-to-month’ and Churn as‘Yes’


1
Expert's answer
2022-03-14T10:31:04-0400
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv('mtcars.csv')
df1 = pd.read_csv('churn.csv')


plt.plot(df['am'], df['carbs'])
plt.title('Transmission vs Number of carburetors')
plt.xlabel('Transmission')
plt.ylabel('Number of carburetors')
plt.show()

#1
df1[df1['Tenure']>50 & df1['gender'] == 'female']
#2
df1[df1['SeniorCitizen']==0 & df1['gender'] == 'male']
#3
df1[df1['TechSupport']=='yes' & df1['Churn'] == 'no']
#4
df1[df1['Contract type']=='Month-to-month' & df1['Churn'] == 'Yes']

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS