Skip to content

Commit

Permalink
Added Pandas_API.ipynb docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nipsn committed Dec 4, 2023
1 parent a56c6c1 commit d69d515
Showing 1 changed file with 67 additions and 2 deletions.
69 changes: 67 additions & 2 deletions docs/user-guide/advanced/Pandas_API.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2259,6 +2259,71 @@
"tab.abs(numeric_only=True)"
]
},
{
"cell_type": "markdown",
"id": "499cac52",
"metadata": {},
"source": [
"### Table.round()\n",
"\n",
"```\n",
"Table.round(self, decimals: Union[int, Dict[str, int]] = 0)\n",
"```\n",
"\n",
"Round a Table to a variable number of decimal places.\n",
"\n",
"\n",
"**Parameters:**\n",
"\n",
"| Name | Type | Description | Default |\n",
"| :--------------: | :-----------------: | :------------------------------------------------------------ | :-----: |\n",
"| decimals | int or Dict or list | Number of decimal places to round each column to. If an int is given, round each column to the same number of places. Otherwise dict and list round to variable numbers of places. Column names should be in the keys if decimals is a dict-like, or in the index if decimals is a list. Any columns not included in decimals will be left as is. Elements of decimals which are not columns of the input will be ignored.| 0 |\n",
"\n",
"**Note: functionality for list nyi**\n",
"\n",
"**Returns:**\n",
"\n",
"| Type | Description |\n",
"| :--------: | :--------------------------------------------------------------------------------------- |\n",
"| Table | A Table with the affected columns rounded to the specified number of decimal places. |\n"
]
},
{
"cell_type": "markdown",
"id": "1b629def",
"metadata": {},
"source": [
"If an integer is provided it rounds every float column to set decimals."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "08c182c9",
"metadata": {},
"outputs": [],
"source": [
"tab.round(1)"
]
},
{
"cell_type": "markdown",
"id": "28853fc0",
"metadata": {},
"source": [
"If a dict whose keys are the column names and its values are the decimals to round set column is provided, it will round them accordingly.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7640df4c",
"metadata": {},
"outputs": [],
"source": [
"tab.round({\"price\": 1, \"traded\": 0})"
]
},
{
"cell_type": "markdown",
"id": "ad57d9cf",
Expand Down Expand Up @@ -2975,7 +3040,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -2989,7 +3054,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down

0 comments on commit d69d515

Please sign in to comment.