Skip to content

AttributeError: 'DataArray' object has no attribute 'polyfit' #3902

Closed
@Hossein-Madadi

Description

@Hossein-Madadi

I used the below code in jupyterlab with xarray 0.15.1:
x = xr.DataArray(np.arange(10), dims=['x'], name='x')
a = xr.DataArray(3 + 4 * x, dims=['x'], coords={'x': x})
out = a.polyfit(dim='x', deg=1, full=True)
out

But output ERROR:


AttributeError Traceback (most recent call last)
in
1 x = xr.DataArray(np.arange(10), dims=['x'], name='x')
2 a = xr.DataArray(3 + 4 * x, dims=['x'], coords={'x': x})
----> 3 out = a.polyfit(dim='x', deg=1, full=True)
4 out

C:\ProgramData\Anaconda3\lib\site-packages\xarray\core\common.py in getattr(self, name)
231 return source[name]
232 raise AttributeError(
--> 233 "{!r} object has no attribute {!r}".format(type(self).name, name)
234 )
235

AttributeError: 'DataArray' object has no attribute 'polyfit'

What is the meaning of this error?!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions