简体   繁体   中英

Combining two dataframes with different time intervals

I am doing a study in school about the effect of noise in a person's environment and his/her activity.

I have two dataframes with data I would like to compare. The data was recorded at the same time, but the time intervals between measurements are different. This makes it hard for me to overlay a plot and look at possible correlations.

The data frames look like this:

Volume level:

图像音量 df

steps:

图像步骤 df

When I try to put these two dataframes in one plot with a sync timeline, the steps graph looks way smaller than the volume level graph. I have tried to plot the two graphs in multiple ways, but I keep ending up with something like this:

我最终的情节

How about this. This code uses multi y axis so it will help you with your problem that the graph size doesn't fit.

ax = steps_Niels_1st["steps"].plot()
ax1 = ax.twinx()
ax = volume_data_Niels_1st['size'].plot(ax=ax1)
plt.show()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM