google-trends-daily icon indicating copy to clipboard operation
google-trends-daily copied to clipboard

Renormalize in forward direction?

Open wbensvage opened this issue 5 years ago • 1 comments

Great work! I noticed that you are doing the renormalize in backward direction, say, from most recent date back.

Is that possible to do renormalization in forward direction so that we could extend the trend data in live? Like we could update the trend data day by day and regard "today's" data as the unit?

I did a little experiment but the data exploded. So I wonder if you found a better way to do that?

wbensvage avatar Feb 21 '21 02:02 wbensvage

Could you share your code where the data exploded ?

My first intuition would be to change this part:

y1 = temp.loc[overlap_start:end_d].iloc[:,0].values.max()
y2 = df.loc[overlap_start:end_d].iloc[:,-1].values.max()
coef = y2/y1
temp = temp * coef

into

y1 = temp.loc[overlap_start:end_d].iloc[:,0].values.max()
y2 = df.loc[overlap_start:end_d].iloc[:,-1].values.max()
coef = y1/y2
df = df * coef

But we might need some real examples to test and experiment....

qztseng avatar Feb 22 '21 13:02 qztseng