bernardodionisi/differences

problem with datetime index

Closed this issue · 4 comments

I am having this error when executing the ATTgt function: "TypeError: a value for 'freq' of the datetime index must be provided."
I have a dataset with firm ID and month-year multiIndex: "MultiIndex: 2483760 entries, (815, Timestamp('2020-01-01 00:00:00')) to (98762404, Timestamp('2021-12-01 00:00:00'))."
My cohort variable is a month of the year variable reffering to the month of the first treatment, and it is datetime type: "mes_ft datetime64[ns]"
Any idea of what is going on?
Thanks in advance!

I think you just need to set the frequency of your datetime index.

Please refer to freq parameter in the ATTgt documentation for more details.

Let me know if this solves the issue; otherwise, I may need more information from you, like an example dataset and a snippet of code.

Thanks for the reply. I have just set the frequency of my datetime index and running it again. I have generated my cohort variable as a function of my datetime variable (before setting it to index). Is it ok that the cohort variable be a datetime variable?

The cohort column must be a datetime if the time index is a datetime, if I remember correctly

It worked well after setting frequency. Thank you for the help. Best regards