yfinance datetime error

33 views
Skip to first unread message

Matthew Berry

unread,
May 29, 2023, 9:02:17 AM5/29/23
to xlSlim Support
Hi!

Does anyone have any ideas about this error?

When running the yfinance_data.py example with the inputs [MSFT, 30d] I get the following error text returned by ViewPyObject():

 #ERR The function call failed - Cannot interpret 'datetime64[ns, America/New_York]' as a data type 


I am using a local Python 3.10 64-Bit installation with the yfinance module installed.

Thanks so much!
Matt

Matthew Berry

unread,
May 29, 2023, 9:10:00 AM5/29/23
to xlSlim Support
A bit more info from the log file:

2023-05-29 09:04:34.0666 ERROR xlSlim.AddInRegistration Unhandled exception: Python.Runtime.PythonException: Cannot interpret 'datetime64[ns, America/New_York]' as a data type
   at Python.Runtime.PythonException.ThrowLastAsClrException()
   at Python.Runtime.PyObject.Invoke(PyTuple args, PyDict kw)
   at Python.Runtime.PyObject.InvokeMethod(String name, PyTuple args, PyDict kw)
   at Python.Runtime.PyObject.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result)
   at CallSite.Target(Closure , CallSite , Object , PyObject )
   at PyInternals.PyPandasDataFrameConversions.AsNetArray(PyObject o)
   at PyInternals.PyPandasDataFrame.ToArray()
   at xlSlim.AddInRegistration.ViewPyObject(String key)
   at ViewPyObject(Closure , IntPtr ) 

xlSlim Dev

unread,
May 29, 2023, 9:57:35 AM5/29/23
to Matthew Berry, xlSlim Support
Hi Matt,

Which version of xlslim are you using?

Thanks,
Russel 

--
You received this message because you are subscribed to the Google Groups "xlSlim Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xlslim-suppor...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/xlslim-support/3a32b20d-d69f-496e-bed6-3005c1d2075en%40googlegroups.com.

Matthew Berry

unread,
May 29, 2023, 10:08:43 AM5/29/23
to xlSlim Support
Version 2.1.0.0

xlSlim Dev

unread,
May 29, 2023, 10:55:36 AM5/29/23
to xlSlim Support
Hi Matt,

I can reproduce the error. It is a problem with the ViewPyObject functionality not understanding timezone aware datetimes as used within pandas. I had not seen this problem before. yfinance has started returning datetimes with timezones since I created that demo in 2022.

I will improve the ViewPyObject() functionality in the next xlSlim release.

In the meantime, to get the yfinance demo to work, please downgrade to yfinance 0.1.70.

I did this using:
pip uninstall yfinance
pip install yfinance==0.1.70

Thank you for raising this.

All the best,
Russel

Matthew Berry

unread,
May 29, 2023, 11:37:40 AM5/29/23
to xlSlim Support
OK, I can do that.  Thanks for the info!

xlSlim Dev

unread,
Jun 2, 2023, 10:52:45 AM6/2/23
to Matthew Berry, xlSlim Support
This should now be fixed in v3.0.0


All the best,
Russel

Matthew Berry

unread,
Jun 2, 2023, 1:27:27 PM6/2/23
to xlSlim Support
Thanks!  Confirmed - v3 works with yfinance 0.2.18
Reply all
Reply to author
Forward
0 new messages