IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Foundations of Inference in Python

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# 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.____[____:(____ + ____)]
Modifica ed esegui il codice