question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: Rolling on Dataset

See original GitHub issue

This looks like it’s available with dir / tab complete, but actually isn’t:

In [13]: xr.DataArray(np.random.rand(10,3)).to_dataset('dim_1').rolling
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-13-438d3638a0d0> in <module>()
----> 1 xr.DataArray(np.random.rand(10,3)).to_dataset('dim_1').rolling

/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/xarray/core/common.py in __getattr__(self, name)
    135                     return source[name]
    136         raise AttributeError("%r object has no attribute %r" %
--> 137                              (type(self).__name__, name))
    138 
    139     def __setattr__(self, name, value):

AttributeError: 'Dataset' object has no attribute 'rolling'

I think this could be easy to implement as an .apply operation? (indeed, that could be a reasonable path for a whole host of operations - i.e. try and apply them to each array in the ds?)

Also, as a very narrow point, I’m not sure why .rolling_cls is public? Probably should be private?

Finally, the Rolling implementation is pretty sweet. I’ve been getting my hands dirty in the pandas one recently, and that we can have something as well featured as that with so few lines of code 👍

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
fmaussioncommented, Jan 10, 2017

This just happened to me too:

In [1]: import xarray as xr
In [2]: ds = xr.open_dataset('ERA-Int-Monthly-UVSLP.nc')
In [3]: ds = ds.rolling()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-16ff572cfc35> in <module>()
----> 1 ds = ds.rolling()

/home/mowglie/Documents/git/xarray/xarray/core/common.py in rolling(self, min_periods, center, **windows)
    507         """
    508 
--> 509         return self.rolling_cls(self, min_periods=min_periods,
    510                                 center=center, **windows)
    511 

/home/mowglie/Documents/git/xarray/xarray/core/common.py in __getattr__(self, name)
    224                     return source[name]
    225         raise AttributeError("%r object has no attribute %r" %
--> 226                              (type(self).__name__, name))
    227 
    228     def __setattr__(self, name, value):

AttributeError: 'Dataset' object has no attribute 'rolling_cls'
0reactions
max-sixtycommented, Feb 21, 2017

Did this ever get fixed?

Not fixed yet, but PRs welcome

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best Practices for Reporting Bugs | Data Science and Machine ...
Best Practices for Reporting Bugs. ... We are rolling out a fix. ... How actively is the Kaggle team monitoring the forums for...
Read more >
How to reduce the incidence of data related bugs? - Questions
The automation environment data is managed by either clearing down all the database tables before a test run, or backing up and restoring...
Read more >
BUG-000097715: Image datasets with yaw, pitch, and roll ...
Synopsis. Image datasets with yaw, pitch, and roll values fail in Drone2Map for ArcGIS during processing with the following error, "XML file validation...
Read more >
Create an Active bugs Power BI report - Azure DevOps
Learn how to create an Analytics view to filter a dataset for active bugs and then create a trend report in Power BI....
Read more >
Machine Learning-Based Bug Handling in Large-Scale ...
t-SNE rendering of a bug database using unstructured text via ... instance, a random variable X could take the event ”the rolled die...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found