Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in using - rdtools.degradation_year_on_year - function #374

Open
AlbertoFollo opened this issue May 23, 2023 · 1 comment
Open

Error in using - rdtools.degradation_year_on_year - function #374

AlbertoFollo opened this issue May 23, 2023 · 1 comment

Comments

@AlbertoFollo
Copy link

AlbertoFollo commented May 23, 2023

I'm trying to calculate the performance loss rate of a vertically installed PV module using the function rdtools.degradation_year_on_year.
However, the following error displays every time I run the function.

ValueError: Cannot convert from timedelta64[ns] to timedelta64[h]. Supported resolutions are 's', 'ms', 'us', 'ns'.

Here is what I'm doing:

daily['Timestamp'] = daily.index
daily['Timestamp'] = daily['Timestamp'].dt.to_timestamp() # From period(D) to DateTime

daily = daily.set_index(daily['Timestamp'])
daily = daily.rename(columns = {'PR [%]': 'PR'})

MPR = daily.PR
MPR.index = daily.index

yoy_rd, yoy_ci, yoy_info = rdtools.degradation_year_on_year(MPR, confidence_level=95)

Where, daily.info()

DatetimeIndex: 1147 entries, 2020-02-27 to 2023-04-18
Data columns (total 6 columns):
Column Non-Null Count Dtype


0 H [Wh/m2] 954 non-null float64
1 Em [Wh] 954 non-null float64
2 Em_Tcorr [Wh] 954 non-null float64
3 PR 954 non-null float64
4 PR_Tcorr [%] 954 non-null float64
5 Timestamp 1147 non-null datetime64[ns]
dtypes: datetime64ns, float64(5)
memory usage: 62.7 KB

I tried to convert datetime64[ns] to datetime64[h] before running the function, but there seems to be no way to do this in python.

@kandersolar
Copy link
Member

Hi @AlbertoFollo, what versions of RdTools and pandas are you using? The error you're seeing might be caused by an incompatibility between previous versions of RdTools and pandas 2.0 (see #361 and #362). Downgrading to pandas 1.x, or using the latest RdTools (2.1.5), might fix the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants