diff --git a/docs/user-guide/advanced/Pandas_API.ipynb b/docs/user-guide/advanced/Pandas_API.ipynb index cb98590..1f63ec9 100644 --- a/docs/user-guide/advanced/Pandas_API.ipynb +++ b/docs/user-guide/advanced/Pandas_API.ipynb @@ -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", @@ -2975,7 +3040,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -2989,7 +3054,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.3" + "version": "3.8.10" } }, "nbformat": 4,