Concatenate DataFrames
Let's assume you have gathered multiple datasets about your environment for the same time period, and would like to analyze them.
The first step is to combine the datasets into one, to comfortably work with them.
You'll work on combining the three DataFrames temperature
, humidity
, and windspeed
.
Este exercício faz parte do curso
Analyzing IoT Data in Python
Instruções do exercício
- Rename the columns of the DataFrames to match
"temperature"
,"humidity"
and"windspeed"
. - Create a list of DataFrames
df_list
containing the DataFramestemperature
,humidity
, andwindspeed
, in this order. - Concatenate the list of DataFrames into one and name that
environment
. Each DataFrame should get it's own column. - Print the head of the combined DataFrame.
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Rename the columns
temperature.columns = [____]
humidity.columns = ____
____
# Create list of DataFrames
df_list = [____]
# Concatenate files
environment = pd.concat(____, ____)
# Print first rows of the DataFrame
____