BaşlayınÜcretsiz Başlayın

Random assignment of subjects

Having built trust from your last work with the agricultural firm, you have been given the task of properly setting up the experiment.

Use your knowledge of best practice experimental design set up to assign the sheep to two even groups of 250 each.

The weights DataFrame is available for you to use. Additionally, numpy and pandas have been imported as np and pd respectively.

Bu egzersiz

Experimental Design in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Randomly select 250 subjects from the weights DataFrame into a new DataFrame group1 without replacement.
  • Put the remaining 250 subjects into group2.
  • Concatenate the descriptive statistics of your two newly created DataFrames.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Randomly assign half
group1_random = weights.____(____, random_state=42, ____)

# Create second assignment
group2_random = weights.____(group1_random.____)

# Compare assignments
compare_df_random = pd.concat([group1_random['weight'].____, group2_random['weight'].____], axis=1)
compare_df_random.columns = ['group1', 'group2']
print(compare_df_random)
Kodu Düzenle ve Çalıştır