Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgsavage committed Dec 30, 2024
1 parent 0657bfc commit 90c16fe
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/getting/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Operations with columns are units aware so behave as we would intuitively expect

Notice that the units are not displayed in the cells of the DataFrame.
If you ever see units in the cells of the DataFrame, something isn't right.
See :ref:`units_in_cells` for more information.
See :doc:`Units in Cells <../user/common>` for more information.

We can see the columns' units in the dtypes attribute

Expand Down
17 changes: 17 additions & 0 deletions docs/user/initializing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,20 @@ To avoid this conversion, specify the subdtype (dtype of the magnitudes) in the
.. note::

``"pint[unit]"`` or ``"pint[unit][subdtype]"`` must be used for the Series or DataFrame constuctor.

Non-native pandas dtypes
-------------------------

``PintArray`` uses an ``ExtensionArray`` to hold its data inclluding those from other libraries that extend pandas.
For example, an ``UncertaintyArray`` can be used.

.. ipython:: python
from uncertainties_pandas import UncertaintyArray, UncertaintyDtype
from uncertainties import ufloat, umath, unumpy
ufloats = [ufloat(i, abs(i) / 100) for i in [4.0, np.nan, -5.0]]
uarr = UncertaintyArray(ufloats)
uarr
PintArray(uarr,"m")
pd.Series(PintArray(uarr,"m")*2)
4 changes: 2 additions & 2 deletions docs/user/numpy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ Numpy functions that work on pint ``Quantity`` ``ndarray`` objects also work on
PintArray = pint_pandas.PintArray
ureg = pint_pandas.PintType.ureg
Q_ = ureg.Quantity
Quantity = ureg.Quantity
.. ipython:: python
pa = PintArray([1, 2, np.nan, 4, 10], dtype="pint[m]")
np.clip(pa, 3 * ureg.m, 5 * ureg.m)
Expand Down
1 change: 1 addition & 0 deletions requirements_docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ sphinx-book-theme>=1.1.0
sphinx_copybutton
sphinx_design
typing_extensions
uncertainties-pandas

0 comments on commit 90c16fe

Please sign in to comment.