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

Save your analysis to multiple excel worksheets

Now that you have completed your analysis, you may want to save all results into a single Excel workbook.

Let's practice exporting various DataFrame to multiple Excel worksheets.

Bu egzersiz

Manipulating Time Series Data in Python

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

Egzersiz talimatları

We have already imported pandas as pd for you. We have also loaded both the historical price series of your index constituents into the variable stock_prices, and the index as index.

  • Inspect both index and stock_prices using .info().
  • Use .join() to combine index with stock_prices, and assign to data.
  • Apply .pct_change() to data and assign to returns.
  • Create pd.ExcelWriter and use with to export data and returns to excel with sheet_names of the same name.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Inspect index and stock_prices
print(____)
print(____)

# Join index to stock_prices, and inspect the result
data = ____
print(____)

# Create index & stock price returns
returns = ____

# Export data and data as returns to excel
with pd.ExcelWriter('data.xls') as writer:
    data.____
    returns.____
Kodu Düzenle ve Çalıştır