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’
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']
Comments
Leave a comment