prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Update pandas dependency
  As documented in #967, pandas will be fixing the breaking change that led us to fix the dependency to `<1.1`, see pandas-dev/pandas#37267
  
  Once that is resolved, we could remove the constraint.
  
  *Edit:* we should also make sure to find a solution to #965 first
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/gluonts/time_feature/_base.py`
  Content:
  ```
  1 # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License").
  4 # You may not use this file except in compliance with the License.
  5 # A copy of the License is located at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # or in the "license" file accompanying this file. This file is distributed
  10 # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  11 # express or implied. See the License for the specific language governing
  12 # permissions and limitations under the License.
  13 
  14 from typing import List
  15 
  16 # Third-party imports
  17 import numpy as np
  18 import pandas as pd
  19 from pandas.tseries import offsets
  20 from pandas.tseries.frequencies import to_offset
  21 
  22 # First-party imports
  23 from gluonts.core.component import validated
  24 
  25 
  26 class TimeFeature:
  27     """
  28     Base class for features that only depend on time.
  29     """
  30 
  31     @validated()
  32     def __init__(self, normalized: bool = True):
  33         self.normalized = normalized
  34 
  35     def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
  36         pass
  37 
  38     def __repr__(self):
  39         return self.__class__.__name__ + "()"
  40 
  41 
  42 class MinuteOfHour(TimeFeature):
  43     """
  44     Minute of hour encoded as value between [-0.5, 0.5]
  45     """
  46 
  47     def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
  48         if self.normalized:
  49             return index.minute / 59.0 - 0.5
  50         else:
  51             return index.minute.map(float)
  52 
  53 
  54 class HourOfDay(TimeFeature):
  55     """
  56     Hour of day encoded as value between [-0.5, 0.5]
  57     """
  58 
  59     def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
  60         if self.normalized:
  61             return index.hour / 23.0 - 0.5
  62         else:
  63             return index.hour.map(float)
  64 
  65 
  66 class DayOfWeek(TimeFeature):
  67     """
  68     Hour of day encoded as value between [-0.5, 0.5]
  69     """
  70 
  71     def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
  72         if self.normalized:
  73             return index.dayofweek / 6.0 - 0.5
  74         else:
  75             return index.dayofweek.map(float)
  76 
  77 
  78 class DayOfMonth(TimeFeature):
  79     """
  80     Day of month encoded as value between [-0.5, 0.5]
  81     """
  82 
  83     def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
  84         if self.normalized:
  85             return index.day / 30.0 - 0.5
  86         else:
  87             return index.day.map(float)
  88 
  89 
  90 class DayOfYear(TimeFeature):
  91     """
  92     Day of year encoded as value between [-0.5, 0.5]
  93     """
  94 
  95     def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
  96         if self.normalized:
  97             return index.dayofyear / 364.0 - 0.5
  98         else:
  99             return index.dayofyear.map(float)
  100 
  101 
  102 class MonthOfYear(TimeFeature):
  103     """
  104     Month of year encoded as value between [-0.5, 0.5]
  105     """
  106 
  107     def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
  108         if self.normalized:
  109             return index.month / 11.0 - 0.5
  110         else:
  111             return index.month.map(float)
  112 
  113 
  114 class WeekOfYear(TimeFeature):
  115     """
  116     Week of year encoded as value between [-0.5, 0.5]
  117     """
  118 
  119     def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:
  120         if self.normalized:
  121             return index.weekofyear / 51.0 - 0.5
  122         else:
  123             return index.weekofyear.map(float)
  124 
  125 
  126 def time_features_from_frequency_str(freq_str: str) -> List[TimeFeature]:
  127     """
  128     Returns a list of time features that will be appropriate for the given frequency string.
  129 
  130     Parameters
  131     ----------
  132 
  133     freq_str
  134         Frequency string of the form [multiple][granularity] such as "12H", "5min", "1D" etc.
  135 
  136     """
  137 
  138     features_by_offsets = {
  139         offsets.YearOffset: [],
  140         offsets.MonthOffset: [MonthOfYear],
  141         offsets.Week: [DayOfMonth, WeekOfYear],
  142         offsets.Day: [DayOfWeek, DayOfMonth, DayOfYear],
  143         offsets.BusinessDay: [DayOfWeek, DayOfMonth, DayOfYear],
  144         offsets.Hour: [HourOfDay, DayOfWeek, DayOfMonth, DayOfYear],
  145         offsets.Minute: [
  146             MinuteOfHour,
  147             HourOfDay,
  148             DayOfWeek,
  149             DayOfMonth,
  150             DayOfYear,
  151         ],
  152     }
  153 
  154     offset = to_offset(freq_str)
  155 
  156     for offset_type, feature_classes in features_by_offsets.items():
  157         if isinstance(offset, offset_type):
  158             return [cls() for cls in feature_classes]
  159 
  160     supported_freq_msg = f"""
  161     Unsupported frequency {freq_str}
  162 
  163     The following frequencies are supported:
  164 
  165         Y   - yearly
  166             alias: A
  167         M   - monthly
  168         W   - weekly
  169         D   - daily
  170         B   - business days
  171         H   - hourly
  172         T   - minutely
  173             alias: min
  174     """
  175     raise RuntimeError(supported_freq_msg)
  176
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/src/gluonts/time_feature/_base.py b/src/gluonts/time_feature/_base.py
  --- a/src/gluonts/time_feature/_base.py
  +++ b/src/gluonts/time_feature/_base.py
  @@ -136,8 +136,8 @@
       """
   
       features_by_offsets = {
  -        offsets.YearOffset: [],
  -        offsets.MonthOffset: [MonthOfYear],
  +        offsets.YearEnd: [],
  +        offsets.MonthEnd: [MonthOfYear],
           offsets.Week: [DayOfMonth, WeekOfYear],
           offsets.Day: [DayOfWeek, DayOfMonth, DayOfYear],
           offsets.BusinessDay: [DayOfWeek, DayOfMonth, DayOfYear],
  
verification_info: {"golden_diff": "diff --git a/src/gluonts/time_feature/_base.py b/src/gluonts/time_feature/_base.py\n--- a/src/gluonts/time_feature/_base.py\n+++ b/src/gluonts/time_feature/_base.py\n@@ -136,8 +136,8 @@\n     \"\"\"\n \n     features_by_offsets = {\n-        offsets.YearOffset: [],\n-        offsets.MonthOffset: [MonthOfYear],\n+        offsets.YearEnd: [],\n+        offsets.MonthEnd: [MonthOfYear],\n         offsets.Week: [DayOfMonth, WeekOfYear],\n         offsets.Day: [DayOfWeek, DayOfMonth, DayOfYear],\n         offsets.BusinessDay: [DayOfWeek, DayOfMonth, DayOfYear],\n", "issue": "Update pandas dependency\nAs documented in #967, pandas will be fixing the breaking change that led us to fix the dependency to `<1.1`, see pandas-dev/pandas#37267\r\n\r\nOnce that is resolved, we could remove the constraint.\r\n\r\n*Edit:* we should also make sure to find a solution to #965 first\n", "before_files": [{"content": "# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\").\n# You may not use this file except in compliance with the License.\n# A copy of the License is located at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# or in the \"license\" file accompanying this file. This file is distributed\n# on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n# express or implied. See the License for the specific language governing\n# permissions and limitations under the License.\n\nfrom typing import List\n\n# Third-party imports\nimport numpy as np\nimport pandas as pd\nfrom pandas.tseries import offsets\nfrom pandas.tseries.frequencies import to_offset\n\n# First-party imports\nfrom gluonts.core.component import validated\n\n\nclass TimeFeature:\n    \"\"\"\n    Base class for features that only depend on time.\n    \"\"\"\n\n    @validated()\n    def __init__(self, normalized: bool = True):\n        self.normalized = normalized\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        pass\n\n    def __repr__(self):\n        return self.__class__.__name__ + \"()\"\n\n\nclass MinuteOfHour(TimeFeature):\n    \"\"\"\n    Minute of hour encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.minute / 59.0 - 0.5\n        else:\n            return index.minute.map(float)\n\n\nclass HourOfDay(TimeFeature):\n    \"\"\"\n    Hour of day encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.hour / 23.0 - 0.5\n        else:\n            return index.hour.map(float)\n\n\nclass DayOfWeek(TimeFeature):\n    \"\"\"\n    Hour of day encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.dayofweek / 6.0 - 0.5\n        else:\n            return index.dayofweek.map(float)\n\n\nclass DayOfMonth(TimeFeature):\n    \"\"\"\n    Day of month encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.day / 30.0 - 0.5\n        else:\n            return index.day.map(float)\n\n\nclass DayOfYear(TimeFeature):\n    \"\"\"\n    Day of year encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.dayofyear / 364.0 - 0.5\n        else:\n            return index.dayofyear.map(float)\n\n\nclass MonthOfYear(TimeFeature):\n    \"\"\"\n    Month of year encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.month / 11.0 - 0.5\n        else:\n            return index.month.map(float)\n\n\nclass WeekOfYear(TimeFeature):\n    \"\"\"\n    Week of year encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.weekofyear / 51.0 - 0.5\n        else:\n            return index.weekofyear.map(float)\n\n\ndef time_features_from_frequency_str(freq_str: str) -> List[TimeFeature]:\n    \"\"\"\n    Returns a list of time features that will be appropriate for the given frequency string.\n\n    Parameters\n    ----------\n\n    freq_str\n        Frequency string of the form [multiple][granularity] such as \"12H\", \"5min\", \"1D\" etc.\n\n    \"\"\"\n\n    features_by_offsets = {\n        offsets.YearOffset: [],\n        offsets.MonthOffset: [MonthOfYear],\n        offsets.Week: [DayOfMonth, WeekOfYear],\n        offsets.Day: [DayOfWeek, DayOfMonth, DayOfYear],\n        offsets.BusinessDay: [DayOfWeek, DayOfMonth, DayOfYear],\n        offsets.Hour: [HourOfDay, DayOfWeek, DayOfMonth, DayOfYear],\n        offsets.Minute: [\n            MinuteOfHour,\n            HourOfDay,\n            DayOfWeek,\n            DayOfMonth,\n            DayOfYear,\n        ],\n    }\n\n    offset = to_offset(freq_str)\n\n    for offset_type, feature_classes in features_by_offsets.items():\n        if isinstance(offset, offset_type):\n            return [cls() for cls in feature_classes]\n\n    supported_freq_msg = f\"\"\"\n    Unsupported frequency {freq_str}\n\n    The following frequencies are supported:\n\n        Y   - yearly\n            alias: A\n        M   - monthly\n        W   - weekly\n        D   - daily\n        B   - business days\n        H   - hourly\n        T   - minutely\n            alias: min\n    \"\"\"\n    raise RuntimeError(supported_freq_msg)\n", "path": "src/gluonts/time_feature/_base.py"}], "after_files": [{"content": "# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\").\n# You may not use this file except in compliance with the License.\n# A copy of the License is located at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# or in the \"license\" file accompanying this file. This file is distributed\n# on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n# express or implied. See the License for the specific language governing\n# permissions and limitations under the License.\n\nfrom typing import List\n\n# Third-party imports\nimport numpy as np\nimport pandas as pd\nfrom pandas.tseries import offsets\nfrom pandas.tseries.frequencies import to_offset\n\n# First-party imports\nfrom gluonts.core.component import validated\n\n\nclass TimeFeature:\n    \"\"\"\n    Base class for features that only depend on time.\n    \"\"\"\n\n    @validated()\n    def __init__(self, normalized: bool = True):\n        self.normalized = normalized\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        pass\n\n    def __repr__(self):\n        return self.__class__.__name__ + \"()\"\n\n\nclass MinuteOfHour(TimeFeature):\n    \"\"\"\n    Minute of hour encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.minute / 59.0 - 0.5\n        else:\n            return index.minute.map(float)\n\n\nclass HourOfDay(TimeFeature):\n    \"\"\"\n    Hour of day encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.hour / 23.0 - 0.5\n        else:\n            return index.hour.map(float)\n\n\nclass DayOfWeek(TimeFeature):\n    \"\"\"\n    Hour of day encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.dayofweek / 6.0 - 0.5\n        else:\n            return index.dayofweek.map(float)\n\n\nclass DayOfMonth(TimeFeature):\n    \"\"\"\n    Day of month encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.day / 30.0 - 0.5\n        else:\n            return index.day.map(float)\n\n\nclass DayOfYear(TimeFeature):\n    \"\"\"\n    Day of year encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.dayofyear / 364.0 - 0.5\n        else:\n            return index.dayofyear.map(float)\n\n\nclass MonthOfYear(TimeFeature):\n    \"\"\"\n    Month of year encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.month / 11.0 - 0.5\n        else:\n            return index.month.map(float)\n\n\nclass WeekOfYear(TimeFeature):\n    \"\"\"\n    Week of year encoded as value between [-0.5, 0.5]\n    \"\"\"\n\n    def __call__(self, index: pd.DatetimeIndex) -> np.ndarray:\n        if self.normalized:\n            return index.weekofyear / 51.0 - 0.5\n        else:\n            return index.weekofyear.map(float)\n\n\ndef time_features_from_frequency_str(freq_str: str) -> List[TimeFeature]:\n    \"\"\"\n    Returns a list of time features that will be appropriate for the given frequency string.\n\n    Parameters\n    ----------\n\n    freq_str\n        Frequency string of the form [multiple][granularity] such as \"12H\", \"5min\", \"1D\" etc.\n\n    \"\"\"\n\n    features_by_offsets = {\n        offsets.YearEnd: [],\n        offsets.MonthEnd: [MonthOfYear],\n        offsets.Week: [DayOfMonth, WeekOfYear],\n        offsets.Day: [DayOfWeek, DayOfMonth, DayOfYear],\n        offsets.BusinessDay: [DayOfWeek, DayOfMonth, DayOfYear],\n        offsets.Hour: [HourOfDay, DayOfWeek, DayOfMonth, DayOfYear],\n        offsets.Minute: [\n            MinuteOfHour,\n            HourOfDay,\n            DayOfWeek,\n            DayOfMonth,\n            DayOfYear,\n        ],\n    }\n\n    offset = to_offset(freq_str)\n\n    for offset_type, feature_classes in features_by_offsets.items():\n        if isinstance(offset, offset_type):\n            return [cls() for cls in feature_classes]\n\n    supported_freq_msg = f\"\"\"\n    Unsupported frequency {freq_str}\n\n    The following frequencies are supported:\n\n        Y   - yearly\n            alias: A\n        M   - monthly\n        W   - weekly\n        D   - daily\n        B   - business days\n        H   - hourly\n        T   - minutely\n            alias: min\n    \"\"\"\n    raise RuntimeError(supported_freq_msg)\n", "path": "src/gluonts/time_feature/_base.py"}]}