Challenge
Tehtävä
Swipe to start coding
It is time for you to practice your skills. Your task is to calculate how many users continue the subscription after the trial period, depending on the plan. Follow the algorithm:
Create a table that helps you retrieve data about users who chose the 'week' plan and continued a subscription after the trial period.
- Chose data where
'plan'
is'week'
. - Choose data where
'trial'
isTrue
.
Ratkaisu
9
1
2
3
4
5
6
7
8
9
import pandas as pd
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/783d7288-e86b-4b89-9966-a2fe97995277/section_2_dataset_upd.csv')
# Create the table
df_week = df.loc[(df['plan'] == 'week') & (df['trial'] == True)]
count_week = df_week['plan'].count()
print("The amount of users who continued weekly subscription after trial period", count_week)
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 3. Luku 15
9
1
2
3
4
5
6
7
8
9
import pandas as pd
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/783d7288-e86b-4b89-9966-a2fe97995277/section_2_dataset_upd.csv')
# Create the table
df_week = df.___[(df['plan'] ___ 'week') ___ (___ True)]
count_week = df_week['plan'].count()
print("The amount of users who continued weekly subscription after trial period", count_week)
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme