{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Accessing Rows and Columns" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Columns are accessed by the column name:\n", "```python\n", " table.columns[column_name]\n", "```\n", "\n", "Rows are ordered by their integer location (iloc) within the DataFrame and can be accessed by that index:\n", "```python\n", " table.rows[idx]\n", "```\n", "\n", "the column label row can be accessed by the `col_label_row` attribute:\n", "```python\n", " table.col_label_row\n", "```\n", "\n", "\n", "After creating a table, you can set cell (rectangle patch) properties and textproperties by accessing functions of the Sequence, ie:\n", "\n", "```python\n", " table.columns[column_name].set_facecolor(\"#f0f0f0\")\n", "\n", " table.rows[0].set_facecolor(\"#f0f0f0\")\n", "```\n", "\n", "Available functions are:\n", "```\n", " # rectangle patch setters\n", " set_alpha\n", " set_color\n", " set_edgecolor\n", " set_facecolor\n", " set_fill\n", " set_hatch\n", " set_linestyle\n", " set_linewidth\n", "\n", " # fontproperty setters\n", " set_fontcolor\n", " set_fontfamily\n", " set_fontsize\n", " set_ha\n", " set_ma\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "```{seealso}\n", "You can find an example of accessing rows and columns in the [Heatmap Example](../example_notebooks/heatmap.ipynb)\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3.10.5 ('env': venv)", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.10.5" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "fad163352f6b6c4f05b9b8d41b1f28c58b235e61ec56c8581176f01128143b49" } } }, "nbformat": 4, "nbformat_minor": 2 }