Skip to content

Conversation

@dsaxton
Copy link
Contributor

@dsaxton dsaxton commented Aug 21, 2020

Tiny doc nit. The doc says you can pass both dtype and fill_value to SparseDtype then only passes one in the example.

@mroeschke mroeschke added this to the 1.2 milestone Aug 22, 2020
@mroeschke mroeschke added Docs Sparse Sparse Data Type labels Aug 22, 2020
@MarcoGorelli
Copy link
Member

The user guide already shows an example on the next line of passing a fill value though - perhaps, instead of making both examples pass a fill value, the wording could be changed so that the first example shows construction with just the dtype of the non-sparse values. Something like

A :class:`SparseDtype` may be constructed by passing the former .. ipython:: python pd.SparseDtype(np.dtype('datetime64[ns]')) , in which case the default fill value for a given NumPy dtype is the "missing" value for that dtype. Note that it may be overridden by passing a `fill_value`, for example .. ipython:: python pd.SparseDtype(np.dtype('datetime64[ns]'), fill_value=pd.Timestamp('2017-01-01')) 
@dsaxton
Copy link
Contributor Author

dsaxton commented Aug 23, 2020

Good point @MarcoGorelli. Actually I changed some other wording as well (it's not entirely true that a missing value indicator will be used for numpy dtypes, e.g., not for integers)

In [1]: import numpy as np In [2]: import pandas as pd In [3]: pd.SparseDtype(np.int64) Out[3]: Sparse[int64, 0]
@mroeschke mroeschke merged commit 54ce729 into pandas-dev:master Aug 31, 2020
@mroeschke
Copy link
Member

Thanks @dsaxton. The CI failure was unrelated

Skipping uploading of coverage data. =================================== ERRORS ==================================== _____ ERROR at setup of TestParquetPyArrow.test_s3_roundtrip_explicit_fs ______ 
@dsaxton dsaxton deleted the sparse-doc branch August 31, 2020 18:47
jbrockmendel pushed a commit to jbrockmendel/pandas that referenced this pull request Aug 31, 2020
* Update SparseDtype user guide doc * Reword
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
* Update SparseDtype user guide doc * Reword
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs Sparse Sparse Data Type

3 participants