home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1223527885

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1223527885 I_kwDOAMm_X85I7Y3N 6567 cftime_range missing freq ("W") - Invalid frequency string provided 17162724 open 0     0 2022-05-03T01:08:01Z 2022-05-03T01:51:59Z   CONTRIBUTOR      

Is your feature request related to a problem?

I tend to use xr.cftime_range as a drop in for pandas.date_range. My only reason here is I may able to shave a line and not import pandas.

In doing xr.cftime_range("2020-01-01", periods=1, freq="W") I get

``` AttributeError Traceback (most recent call last) /opt/userenvs/ray.bell/main/lib/python3.9/site-packages/xarray/coding/cftime_offsets.py in to_offset(freq) 729 try: --> 730 freq_data = re.match(_PATTERN, freq).groupdict() 731 except AttributeError:

AttributeError: 'NoneType' object has no attribute 'groupdict'

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last) /tmp/ipykernel_549/3579801314.py in <module> ----> 1 xr.cftime_range("2020-01-01", periods=1, freq="W")

/opt/userenvs/ray.bell/main/lib/python3.9/site-packages/xarray/coding/cftime_offsets.py in cftime_range(start, end, periods, freq, normalize, name, closed, calendar) 1041 dates = _generate_linear_range(start, end, periods) 1042 else: -> 1043 offset = to_offset(freq) 1044 dates = np.array(list(_generate_range(start, end, periods, offset))) 1045

/opt/userenvs/ray.bell/main/lib/python3.9/site-packages/xarray/coding/cftime_offsets.py in to_offset(freq) 730 freq_data = re.match(_PATTERN, freq).groupdict() 731 except AttributeError: --> 732 raise ValueError("Invalid frequency string provided") 733 734 freq = freq_data["freq"]

ValueError: Invalid frequency string provided ```

In pandas I get

```

pd.date_range("2020-01-01", periods=1, freq="W") DatetimeIndex(['2020-01-05'], dtype='datetime64[ns]', freq='W-SUN') ```

Describe the solution you'd like

No response

Describe alternatives you've considered

Closing this issue as outside of scope

Additional context

No response

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6567/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.964ms · About: xarray-datasette