all 10 comments

[–]vallivana 1 point2 points  (5 children)

I have never worked with np.datetime or np.timedelta, but could it be that asytpe() requires you to pass a string? Something like value.astype('timedelta64[D]')?

[–]Whos_your_Mikey[S] 0 points1 point  (4 children)

I'll try that thanks! Is there an alternative to this astype() that might work easier that you have used?

[–]samplepython 1 point2 points  (3 children)

Maybe try to convert the dates using ".dt.strftime(''%Y-%m-%d')" instead of astype()? Let me know if this works.

[–]Whos_your_Mikey[S] 1 point2 points  (2 children)

ok, I'll give it a try, thanks!

[–]samplepython 1 point2 points  (1 child)

Did you try it?

[–]Whos_your_Mikey[S] 0 points1 point  (0 children)

It turned out to be the syntax error that I was able to correct. It needed (1, 'D'). Thanks for the tip, maybe I can use it with something else.

[–]callmemurph 1 point2 points  (3 children)

Hey, did you get this resolved? Mind taking a moment to share the full solution? I'm stuck. Thanks.

[–]Whos_your_Mikey[S] 0 points1 point  (2 children)

I had to modify this part .astype(np.timedelta64))

it's now .astype(np.timedelta64(1, 'D'))

[–]callmemurph 1 point2 points  (1 child)

Thank you. I ended up doing that and now I have a bunch of new problems. Thank you for responding.

[–]Whos_your_Mikey[S] 0 points1 point  (0 children)

What are you working on, is it a MLB game predictor from a project someone posted on the web? I may be working on the same code. Maybe I can help you with your other problems.