Open AlbertoFollo opened 1 year ago
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.
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.