LoslegenKostenlos loslegen

Load listing info from a single sheet

As you just learned, you can import data from a sheet of an Excel file with the pd.read_excel() function by assigning the optional sheet_name argument to an integer indicating its position or a string containing its name.

pandas.read_excel(file, sheet_name=0, na_values=None, ...)

Here, you will practice by importing NYSE data from a new file, listings.xlsx. pandas has been imported as pd.

Diese Übung ist Teil des Kurses

Importing and Managing Financial Data in Python

Kurs anzeigen

Anleitung zur Übung

  • Read only the 'nyse' worksheet of 'listings.xlsx' where the symbol 'n/a' represents missing values. Assign the result to nyse.
  • Display and inspect nyse with .head() and .info().

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Import the data
nyse = pd.read_excel('listings.xlsx', ____, ____)

# Display the head of the data
print(nyse.head())

# Inspect the data
nyse.info()
Code bearbeiten und ausführen