Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge | Explore Dataset
Introduction to Python for Data Analysis

book
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' is True.

Ratkaisu

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ää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 3. Luku 15
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ä

expand
ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

some-alt