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

Concatenating columns

Now it's time to continue exploring stadiums and turf types as potential factors associated with concussions. It might be interesting to see turf types by season type.

You determined earlier that the games data frame and the stadiums data frame are complementary. It seems reasonable to concatenate them by column. The two data frames are already loaded.

Bu egzersiz

Pandas Joins for Spreadsheet Users

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

Egzersiz talimatları

  • Use the default number of rows for .head() to view the first 5 rows of each data frame.
  • Join the data frames using pd.concat().
  • Cross-tabulate Turf and SeasonType.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# View data frames
print(____.head())
print(____.____())

# Join data frames
games_places = pd.concat([____, ____], 
    axis=____)

# Cross-tabulate Season and Season Type
print(pd.crosstab(games_places.Turf, games_places.SeasonType))
Kodu Düzenle ve Çalıştır