You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the code below, in VS Code, to get my Oura data into df. This works fine for the readiness_df. When I try it for the combined_df_edited, I get an error.
import pandas as pd
from datetime import date, timedelta
from oura import OuraClientDataFrame
from api_token import API_TOKEN
oura_token = API_TOKEN # Your Oura token
client = OuraClientDataFrame(personal_access_token=oura_token) # Make connection
start = '2018-11-01'
days = 7
week_past = str(date.today() - timedelta(days))
readiness_df = client.readiness_df(start=start)
print(readiness_df.head())
combined_df = client.combined_df_edited(start=start)
Error:
`Traceback (most recent call last):
File "c:\Users\stefa\OneDrive\Coding\Oura\test.py", line 22, in <module>
combined_df = client.combined_df_edited(start=start)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\stefa\AppData\Local\Programs\Python\Python311\Lib\site-packages\oura\client_pandas.py", line 198, in combined_df_edited
sleep_df = self.sleep_df(start, end, metrics)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\stefa\AppData\Local\Programs\Python\Python311\Lib\site-packages\oura\client_pandas.py", line 104, in sleep_df
return SleepConverter(convert_cols).convert_metrics(df)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\stefa\AppData\Local\Programs\Python\Python311\Lib\site-packages\oura\converters.py", line 119, in convert_metrics
df = super().convert_metrics(df)
tools\datetimes.py", line 1050, in to_datetime
values = convert_listlike(arg._values, format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\stefa\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\core\tools\datetimes.py", line 453, in _convert_listlike_datetimes
return _array_strptime_with_fallback(arg, name, utc, format, exact, errors)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\stefa\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\core\tools\datetimes.py", line 484, in _array_strptime_with_fallback
result, timezones = array_strptime(arg, fmt, exact=exact, errors=errors, utc=utc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "pandas\_libs\tslibs\strptime.pyx", line 530, in pandas._libs.tslibs.strptime.array_strptime
File "pandas\_libs\tslibs\strptime.pyx", line 351, in pandas._libs.tslibs.strptime.array_strptime
ValueError: time data "2019-11-02T07:10:53+01:00" doesn't match format "%Y-%m-%d %H:%M:%S", at position 0. You might want to try:
- passing `format` if your strings have a consistent format;
- passing `format='ISO8601'` if your strings are all ISO8601 but not necessarily in exactly the same format;
- passing `format='mixed'`, and the format will be inferred for each element individually. You might want to use `dayfirst` alongside this.`
I switched to VS code. Interestingly, this doesn't happen if I run the code in Spyder. I simply get the data without error as expected.
I have no idea why. Do you guys have any ideas about what's wrong?
The text was updated successfully, but these errors were encountered:
Hello. I also encountered the same bug. The cause is likely that this library is not compatible with the latest version of pandas.
Initially, I was using pandas 2.0.x, but when I downgraded to version 1.5.3 and ran it, the error disappeared, and it started functioning properly. Please give it a try.
Thanks for this tip! I don't know what was the exact problem, but I created a new virtual environment in Anaconda with only the basic modules. Now it's running fine, in VS Code and Spyder.
Hey,
I am using the code below, in VS Code, to get my Oura data into df. This works fine for the readiness_df. When I try it for the combined_df_edited, I get an error.
Error:
I switched to VS code. Interestingly, this doesn't happen if I run the code in Spyder. I simply get the data without error as expected.
I have no idea why. Do you guys have any ideas about what's wrong?
The text was updated successfully, but these errors were encountered: