diff options
Diffstat (limited to 'docs/pint-pandas.ipynb')
-rw-r--r-- | docs/pint-pandas.ipynb | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/docs/pint-pandas.ipynb b/docs/pint-pandas.ipynb index 390831e..e213aff 100644 --- a/docs/pint-pandas.ipynb +++ b/docs/pint-pandas.ipynb @@ -6,6 +6,12 @@ "source": [ "# Pandas support\n", "\n", + "<div class=\"alert alert-warning\">\n", + "\n", + "**Warning:** pandas support is currently experimental, don't expect everything to work.\n", + "\n", + "</div>\n", + "\n", "It is convenient to use the Pandas package when dealing with numerical data, so Pint provides PintArray. A PintArray is a Pandas Extension Array, which allows Pandas to recognise the Quantity and store it in Pandas DataFrames and Series." ] }, @@ -13,6 +19,19 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "## Installation\n", + "\n", + "\n", + "Pandas support is provided by `pint-pandas`. It is not available on PyPI yet, to install it use\n", + "```\n", + "python -m pip install git+https://github.com/hgrecco/pint-pandas.git\n", + "```" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ "## Basic example" ] }, @@ -531,8 +550,8 @@ } ], "source": [ - "df = pd.read_csv(io.StringIO(test_data),header=[0,1])\n", - "# df = pd.read_csv(\"/path/to/test_data.csv\",header=[0,1])\n", + "df = pd.read_csv(io.StringIO(test_data), header=[0, 1])\n", + "# df = pd.read_csv(\"/path/to/test_data.csv\", header=[0, 1])\n", "df" ] }, @@ -690,7 +709,7 @@ } ], "source": [ - "df_.speed*df_.torque" + "df_.speed * df_.torque" ] }, { @@ -874,7 +893,7 @@ } ], "source": [ - "df_['mech power'] = df_.speed*df_.torque\n", + "df_['mech power'] = df_.speed * df_.torque\n", "df_['fluid power'] = df_['fuel flow rate'] * df_['rail pressure']\n", "df_" ] @@ -1219,7 +1238,7 @@ } ], "source": [ - "pint.PintType.ureg.default_format = \"~P\"\n", + "pintpandas.PintType.ureg.default_format = \"~P\"\n", "df_.pint.dequantify()" ] }, @@ -1372,7 +1391,7 @@ "metadata": {}, "outputs": [], "source": [ - "PA_ = pint.PintArray" + "PA_ = pintpandas.PintArray" ] }, { @@ -1388,8 +1407,8 @@ "metadata": {}, "outputs": [], "source": [ - "ureg=pint.UnitRegistry()\n", - "Q_=ureg.Quantity" + "ureg = pint.UnitRegistry()\n", + "Q_ = ureg.Quantity" ] }, { @@ -1405,7 +1424,7 @@ "metadata": {}, "outputs": [], "source": [ - "pint.PintType.ureg = ureg" + "pintpandas.PintType.ureg = ureg" ] }, { |