Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions docs/getting/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ Next, we create a DataFrame with PintArrays as columns.

.. ipython:: python

df = pd.DataFrame(
{
"torque": pd.Series([1.0, 2.0, 2.0, 3.0], dtype="pint[lbf ft]"),
"angular_velocity": pd.Series([1.0, 2.0, 2.0, 3.0], dtype="pint[rpm]"),
}
)
df = pd.DataFrame({
"torque": pd.Series([1, 2, 2, 3], dtype="pint[lbf ft]")
"angular_velocity": pd.Series([1, 2, 2, 3], dtype="pint[rpm]")})
df


Expand Down Expand Up @@ -61,19 +58,19 @@ Each column can be accessed as a Pandas Series

.. ipython:: python

df.power
df["power"]

Which contains a PintArray

.. ipython:: python

df.power.values
df["power"].values

The PintArray contains a Quantity

.. ipython:: python

df.power.values.quantity
df["power"].values.quantity

DataFrame Index
-----------------------
Expand All @@ -93,8 +90,8 @@ Methods that return arrays will be converted to Series.

.. ipython:: python

df.power.pint.units
df.power.pint.to("kW")
df["power"].pint.units
df["power"].pint.to("kW")


That's the basics! More examples are given at :doc:`Reading from csv <../user/reading>`.