NREL/OpenOA

Update Pandas Offset Strings

Closed this issue · 1 comments

While running test on the main branch in a fresh environment, 2 deprecation warnings have been raised or Pandas offset strings: 1) "T" should be replaced with "min", and 2) "H" should be replaced with "h".

test/unit/test_filter_toolkit.py::SimpleFilters::test_bin_filter
  <path-removed>/envs/openoa-test/lib/python3.9/site-packages/numpy/lib/nanfunctions.py:1879: RuntimeWarning: Degrees of freedom <= 0 for slice.
    var = nanvar(a, axis=axis, dtype=dtype, out=out, ddof=ddof,

test/unit/test_plant_helpers.py::test_dtype_converter
   <path-removed>/OpenOA/test/unit/test_plant_helpers.py:191: FutureWarning: 'T' is deprecated and will be removed in a future version, please use 'min' instead.
    df.time = pd.date_range(start="2022-July-25 00:00:00", end="2022-July-25 1:00:00", freq="10T")

test/unit/test_timeseries_toolkit.py::SimpleTimeseriesTests::test_gap_fill_data_frame
test/unit/test_timeseries_toolkit.py::SimpleTimeseriesTests::test_gap_fill_data_frame
   <path-removed>/OpenOA/openoa/utils/timeseries.py:213: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.
    return pd.concat([data, gap_df], axis=0).sort_values(dt_col)

test/unit/test_timeseries_toolkit.py::SimpleTimeseriesTests::test_num_hours
test/unit/test_timeseries_toolkit.py::SimpleTimeseriesTests::test_num_hours
test/unit/test_timeseries_toolkit.py::SimpleTimeseriesTests::test_num_hours
   <path-removed>/OpenOA/openoa/utils/timeseries.py:264: FutureWarning: 'H' is deprecated and will be removed in a future version, please use 'h' instead.
    return dt_col[~dt_col.index.duplicated()].resample("H").asfreq().index.size

test/unit/test_unit_conversion_toolkit.py::SimpleUnitConversionTests::test_convert_power_to_energy
   <path-removed>/OpenOA/openoa/utils/unit_conversion.py:32: FutureWarning: 'T' is deprecated and will be removed in a future version, please use 'min' instead.
    _dt_range = pd.date_range(start="09/30/2022", periods=2, freq=sample_rate_min)

test/unit/test_unit_conversion_toolkit.py::SimpleUnitConversionTests::test_convert_power_to_energy
   <path-removed>/OpenOA/openoa/utils/unit_conversion.py:32: FutureWarning: 'H' is deprecated and will be removed in a future version, please use 'h' instead.
    _dt_range = pd.date_range(start="09/30/2022", periods=2, freq=sample_rate_min)

Upon running the regression tests the following should also be udpated:

  • N -> ns
  • S -> s
  • T -> min
  • H -> h
  • U -> us
  • L -> ms