Skip to content

DOC: Remove old SparseDataFrame/SparseSeries references #52092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 21, 2023

Conversation

topper-123
Copy link
Contributor

SparseDataFrame/SparseSeries were removed in v1.0, so it's time to remove the migration docs.

@mroeschke mroeschke added Docs Sparse Sparse Data Type labels Mar 20, 2023
@mroeschke mroeschke added this to the 2.1 milestone Mar 20, 2023
Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like an example on the page needs fixing

023-03-20T20:08:03.0244572Z WARNING: 
2023-03-20T20:08:03.0245214Z looking for now-outdated files... none found
2023-03-20T20:08:03.0245783Z >>>-------------------------------------------------------------------------
2023-03-20T20:08:03.0246328Z Exception in /home/runner/work/pandas/pandas/doc/source/user_guide/sparse.rst at block ending on line 179
2023-03-20T20:08:03.0260443Z Specify :okexcept: as an option in the ipython:: block to suppress this message
2023-03-20T20:08:03.0261387Z ---------------------------------------------------------------------------
2023-03-20T20:08:03.0261877Z AttributeError                            Traceback (most recent call last)
2023-03-20T20:08:03.0262244Z Cell In[31], line 1
2023-03-20T20:08:03.0262655Z ----> 1 df.sparse.to_dense()
2023-03-20T20:08:03.0262890Z 
2023-03-20T20:08:03.0263632Z File ~/work/pandas/pandas/pandas/core/generic.py:6040, in NDFrame.__getattr__(self, name)
2023-03-20T20:08:03.2253217Z    6033 if (
2023-03-20T20:08:03.2253942Z    6034     name not in self._internal_names_set
2023-03-20T20:08:03.2254318Z    6035     and name not in self._metadata
2023-03-20T20:08:03.2254670Z    6036     and name not in self._accessors
2023-03-20T20:08:03.2255072Z    6037     and self._info_axis._can_hold_identifiers_and_holds_name(name)
2023-03-20T20:08:03.2255425Z    6038 ):
2023-03-20T20:08:03.2255650Z    6039     return self[name]
2023-03-20T20:08:03.2256171Z -> 6040 return object.__getattribute__(self, name)
2023-03-20T20:08:03.2256361Z 
2023-03-20T20:08:03.2256693Z File ~/work/pandas/pandas/pandas/core/accessor.py:224, in CachedAccessor.__get__(self, obj, cls)
2023-03-20T20:08:03.2257100Z     221 if obj is None:
2023-03-20T20:08:03.2257570Z     222     # we're accessing the attribute of the class, i.e., Dataset.geo
2023-03-20T20:08:03.2257990Z     223     return self._accessor
2023-03-20T20:08:03.2258388Z --> 224 accessor_obj = self._accessor(obj)
2023-03-20T20:08:03.2258791Z     225 # Replace the property with the accessor object. Inspired by:
2023-03-20T20:08:03.2259308Z     226 # https://www.pydanny.com/cached-property.html
2023-03-20T20:08:03.2259760Z     227 # We need to use object.__setattr__ because we overwrite __setattr__ on
2023-03-20T20:08:03.2260119Z     228 # NDFrame
2023-03-20T20:08:03.2260407Z     229 object.__setattr__(obj, self._name, accessor_obj)
2023-03-20T20:08:03.2260656Z 
2023-03-20T20:08:03.2282207Z File ~/work/pandas/pandas/pandas/core/arrays/sparse/accessor.py:31, in BaseAccessor.__init__(self, data)
2023-03-20T20:08:03.2295625Z      29 def __init__(self, data=None) -> None:
2023-03-20T20:08:03.2296026Z      30     self._parent = data
2023-03-20T20:08:03.2296416Z ---> 31     self._validate(data)
2023-03-20T20:08:03.2296661Z 
2023-03-20T20:08:03.2297456Z File ~/work/pandas/pandas/pandas/core/arrays/sparse/accessor.py:233, in SparseFrameAccessor._validate(self, data)
2023-03-20T20:08:03.2297912Z     231 dtypes = data.dtypes
2023-03-20T20:08:03.2298293Z     232 if not all(isinstance(t, SparseDtype) for t in dtypes):
2023-03-20T20:08:03.2298786Z --> 233     raise AttributeError(self._validation_msg)
2023-03-20T20:08:03.2299052Z 
2023-03-20T20:08:03.2312025Z AttributeError: Can only use the '.sparse' accessor with Sparse data.
2023-03-20T20:08:03.2312380Z pickling environment... done
2023-03-20T20:08:03.2327053Z 
2023-03-20T20:08:03.2327276Z checking consistency... done
2023-03-20T20:08:03.2370234Z <<<-------------------------------------------------------------------------
2023-03-20T20:08:03.2370670Z WARNING: 
2023-03-20T20:08:03.2371077Z >>>-------------------------------------------------------------------------
2023-03-20T20:08:03.2371612Z Exception in /home/runner/work/pandas/pandas/doc/source/user_guide/sparse.rst at block ending on line 179
2023-03-20T20:08:03.2372179Z Specify :okexcept: as an option in the ipython:: block to suppress this message
2023-03-20T20:08:03.2373059Z ---------------------------------------------------------------------------
2023-03-20T20:08:03.2373808Z AttributeError                            Traceback (most recent call last)
2023-03-20T20:08:03.2374179Z Cell In[32], line 1
2023-03-20T20:08:03.2374578Z ----> 1 df.sparse.to_coo()
2023-03-20T20:08:03.2374820Z 
2023-03-20T20:08:03.2407870Z File ~/work/pandas/pandas/pandas/core/generic.py:6040, in NDFrame.__getattr__(self, name)
2023-03-20T20:08:03.2418060Z    6033 if (
2023-03-20T20:08:03.2418445Z    6034     name not in self._internal_names_set
2023-03-20T20:08:03.2418817Z    6035     and name not in self._metadata
2023-03-20T20:08:03.2419185Z    6036     and name not in self._accessors
2023-03-20T20:08:03.2419575Z    6037     and self._info_axis._can_hold_identifiers_and_holds_name(name)
2023-03-20T20:08:03.2419936Z    6038 ):
2023-03-20T20:08:03.2420173Z    6039     return self[name]
2023-03-20T20:08:03.2420685Z -> 6040 return object.__getattribute__(self, name)
2023-03-20T20:08:03.2420970Z 
2023-03-20T20:08:03.2421241Z File ~/work/pandas/pandas/pandas/core/accessor.py:224, in CachedAccessor.__get__(self, obj, cls)
2023-03-20T20:08:03.2421560Z     221 if obj is None:
2023-03-20T20:08:03.2421945Z     222     # we're accessing the attribute of the class, i.e., Dataset.geo
2023-03-20T20:08:03.2422245Z     223     return self._accessor
2023-03-20T20:08:03.2422606Z --> 224 accessor_obj = self._accessor(obj)
2023-03-20T20:08:03.2422933Z     225 # Replace the property with the accessor object. Inspired by:
2023-03-20T20:08:03.2423375Z     226 # https://www.pydanny.com/cached-property.html
2023-03-20T20:08:03.2423842Z     227 # We need to use object.__setattr__ because we overwrite __setattr__ on
2023-03-20T20:08:03.2424201Z     228 # NDFrame
2023-03-20T20:08:03.2424577Z     229 object.__setattr__(obj, self._name, accessor_obj)
2023-03-20T20:08:03.2424828Z 
2023-03-20T20:08:03.2426446Z File ~/work/pandas/pandas/pandas/core/arrays/sparse/accessor.py:31, in BaseAccessor.__init__(self, data)
2023-03-20T20:08:03.2426841Z preparing documents... done
2023-03-20T20:08:03.2450195Z      29 def __init__(self, data=None) -> None:
2023-03-20T20:08:03.2450595Z      30     self._parent = data
2023-03-20T20:08:03.2450986Z ---> 31     self._validate(data)
2023-03-20T20:08:03.2451217Z 
2023-03-20T20:08:03.2472267Z File ~/work/pandas/pandas/pandas/core/arrays/sparse/accessor.py:233, in SparseFrameAccessor._validate(self, data)
2023-03-20T20:08:03.2472786Z     231 dtypes = data.dtypes
2023-03-20T20:08:03.2473182Z     232 if not all(isinstance(t, SparseDtype) for t in dtypes):
2023-03-20T20:08:03.2473731Z --> 233     raise AttributeError(self._validation_msg)
2023-03-20T20:08:03.2473999Z 
2023-03-20T20:08:03.2474322Z AttributeError: Can only use the '.sparse' accessor with Sparse data.

@topper-123
Copy link
Contributor Author

I’ve updated.

@mroeschke mroeschke merged commit 2171154 into pandas-dev:main Mar 21, 2023
@mroeschke
Copy link
Member

Thanks @topper-123

@topper-123 topper-123 deleted the sparse_docs branch March 21, 2023 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Sparse Sparse Data Type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants