So, I have two pandas timers, and the indices on both are timestamps. The fact is that not all timestamps exist on both time servers. I want to perform linear regression on matching points, ignoring those that don't have a “pair”
This is my current solution, but it seems somewhat detailed and ugly:
indexes_used = sorted(list(set(series1).intersection(series2)))
perform_regression(series1.loc[indexes_used], series2.loc[indexes_used])
As an alternative, I was thinking of doing (but creating a temporary data frame seems redundant):
temp_frame = pd.concat([series1, series2]).T.dropna()
perform_regression(blabla)
Is there a good way to do this?
source
share