Aan de slagGa gratis aan de slag

Sampling and point estimates

You have access to a small trading history of Bitcoin (BTC) and the S&P 500 (SP500). You decide to choose ninety consecutive days to analyze the percent growth of each asset over the same time period.

You'll start by selecting an initial row number. To ensure that you get a sample of 90 consecutive rows, you'll need to select this starting row number from a range of values from zero to the length of btc_sp_df, excluding the last 90 rows. Your goal is to use this sample to better understand the growth of both assets in general.

The trading data has been loaded into btc_sp_df, as have the packages pandas as pd and NumPy as np.

Deze oefening maakt deel uit van de cursus

Foundations of Inference in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Select a random starting row number, not including the last 90 rows
initial_row_number = np.random.____(____(len(____) - ____))

# Use initial_row_number to select the next 90 rows from that row number
sample_df = btc_sp_df.____[____:(____ + ____)]
Code bewerken en uitvoeren