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 ejercicio forma parte del curso
Analyzing IoT Data in Python
Instrucciones del ejercicio
- Rename the columns of the DataFrames to match
"temperature","humidity"and"windspeed". - Create a list of DataFrames
df_listcontaining 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.
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# Rename the columns
temperature.columns = [____]
humidity.columns = ____
____
# Create list of DataFrames
df_list = [____]
# Concatenate files
environment = pd.concat(____, ____)
# Print first rows of the DataFrame
____