如果时间相同,则合并来自两个数据集的行,python

Combine rows from two datasets if the have an identical time, python

我有两个数据集,一个名为 "chekan" size(86352,6) 的数组和一个名为 "nav_reduceed_df" size(260757,10) 的数据框。正如您在图中看到的,我的数据有时间戳。我想找到所有具有相同时间的行,并将其放入输出 array/dataframe 中。从时间和日期我计算了两个数据集的小数年(doy),它是 cehkan 数组中的第 6 列和数据框中的第 10 列(deciJday)。 (请注意图中没有显示所有小数)。 .

如果在两个数据集中找到相同的时间,我需要它给我输出(行时间(doy),来自 chekan 数组第 4 列的行值,来自 nav_reduceed_df 的行纬度,来自 nav_reduceed_df)

的行 lon

有人能帮忙吗?

所以让我先将 numpy 数组转换为数据帧..

import pandas as pd
import numpy as np
df_newdata=pd.DataFrame(data=chekan,columns=['d','h','m','s','a','decimal_day'])
df_merge=pd.merge(left_on='decimal_day',right_on='deciJday',how='inner')
df_merge[[give all the columns that you want here]]