From a dictionary of lists
A common way to create pandas
DataFrames is by defining each column. This is especially useful if the data for each column is already in a list or NumPy array. In this exercise, you will take data from multiple lists and create a Python dictionary and a pandas' DataFrame.
The following lists are loaded into your workspace:
date
: dates for each strike, as stringsheight
: the height (feet) at which the strike occurredspeed
: the speed (knots) at which the strike occurredengine
: the engine type for each strikeairport
: the airport associated with each strikedamage
: the severity of damage to the aircraft
Diese Übung ist Teil des Kurses
Python for MATLAB Users
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Create a dictionary from lists
strikes_dict = {'Date' : date,
'Speed' : ____,
'____' : height,
'____' : ____,
'____' : ____,
____ : airport}
# Print dictionary
print(strikes_dict)