Skip to content

Commit 63ebf77

Browse files
authored
update styler user guide for out of date material (#44537)
Co-authored-by: JHM Darbyshire (iMac) <[email protected]>
1 parent e39f0ec commit 63ebf77

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

doc/source/user_guide/style.ipynb

+8-12
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"cell_type": "markdown",
6262
"metadata": {},
6363
"source": [
64-
"The above output looks very similar to the standard DataFrame HTML representation. But the HTML here has already attached some CSS classes to each cell, even if we haven't yet created any styles. We can view these by calling the [.to_html()][to_html] method, which returns the raw HTML as string, which is useful for further processing or adding to a file - read on in [More about CSS and HTML](#More-About-CSS-and-HTML). Below we will show how we can use these to format the DataFrame to be more communicative. For example how we can build `s`:\n",
64+
"The above output looks very similar to the standard DataFrame HTML representation. But the HTML here has already attached some CSS classes to each cell, even if we haven't yet created any styles. We can view these by calling the [.to_html()][tohtml] method, which returns the raw HTML as string, which is useful for further processing or adding to a file - read on in [More about CSS and HTML](#More-About-CSS-and-HTML). Below we will show how we can use these to format the DataFrame to be more communicative. For example how we can build `s`:\n",
6565
"\n",
6666
"[tohtml]: ../reference/api/pandas.io.formats.style.Styler.to_html.rst"
6767
]
@@ -153,7 +153,7 @@
153153
"\n",
154154
"Before adding styles it is useful to show that the [Styler][styler] can distinguish the *display* value from the *actual* value, in both datavlaues and index or columns headers. To control the display value, the text is printed in each cell as string, and we can use the [.format()][formatfunc] and [.format_index()][formatfuncindex] methods to manipulate this according to a [format spec string][format] or a callable that takes a single value and returns a string. It is possible to define this for the whole table, or index, or for individual columns, or MultiIndex levels. \n",
155155
"\n",
156-
"Additionally, the format function has a **precision** argument to specifically help formatting floats, as well as **decimal** and **thousands** separators to support other locales, an **na_rep** argument to display missing data, and an **escape** argument to help displaying safe-HTML or safe-LaTeX. The default formatter is configured to adopt pandas' regular `display.precision` option, controllable using `with pd.option_context('display.precision', 2):` \n",
156+
"Additionally, the format function has a **precision** argument to specifically help formatting floats, as well as **decimal** and **thousands** separators to support other locales, an **na_rep** argument to display missing data, and an **escape** argument to help displaying safe-HTML or safe-LaTeX. The default formatter is configured to adopt pandas' `styler.format.precision` option, controllable using `with pd.option_context('format.precision', 2):` \n",
157157
"\n",
158158
"[styler]: ../reference/api/pandas.io.formats.style.Styler.rst\n",
159159
"[format]: https://docs.python.org/3/library/string.html#format-specification-mini-language\n",
@@ -224,16 +224,15 @@
224224
"\n",
225225
"The index and column headers can be completely hidden, as well subselecting rows or columns that one wishes to exclude. Both these options are performed using the same methods.\n",
226226
"\n",
227-
"The index can be hidden from rendering by calling [.hide_index()][hideidx] without any arguments, which might be useful if your index is integer based. Similarly column headers can be hidden by calling [.hide_columns()][hidecols] without any arguments.\n",
227+
"The index can be hidden from rendering by calling [.hide()][hideidx] without any arguments, which might be useful if your index is integer based. Similarly column headers can be hidden by calling [.hide(axis=\"columns\")][hideidx] without any further arguments.\n",
228228
"\n",
229-
"Specific rows or columns can be hidden from rendering by calling the same [.hide_index()][hideidx] or [.hide_columns()][hidecols] methods and passing in a row/column label, a list-like or a slice of row/column labels to for the ``subset`` argument.\n",
229+
"Specific rows or columns can be hidden from rendering by calling the same [.hide()][hideidx] method and passing in a row/column label, a list-like or a slice of row/column labels to for the ``subset`` argument.\n",
230230
"\n",
231-
"Hiding does not change the integer arrangement of CSS classes, e.g. hiding the first two columns of a DataFrame means the column class indexing will start at `col2`, since `col0` and `col1` are simply ignored.\n",
231+
"Hiding does not change the integer arrangement of CSS classes, e.g. hiding the first two columns of a DataFrame means the column class indexing will still start at `col2`, since `col0` and `col1` are simply ignored.\n",
232232
"\n",
233233
"We can update our `Styler` object from before to hide some data and format the values.\n",
234234
"\n",
235-
"[hideidx]: ../reference/api/pandas.io.formats.style.Styler.hide_index.rst\n",
236-
"[hidecols]: ../reference/api/pandas.io.formats.style.Styler.hide_columns.rst"
235+
"[hideidx]: ../reference/api/pandas.io.formats.style.Styler.hide.rst"
237236
]
238237
},
239238
{
@@ -1413,12 +1412,9 @@
14131412
"## Limitations\n",
14141413
"\n",
14151414
"- DataFrame only (use `Series.to_frame().style`)\n",
1416-
"- The index and columns must be unique\n",
1415+
"- The index and columns do not need to be unique, but certain styling functions can only work with unique indexes.\n",
14171416
"- No large repr, and construction performance isn't great; although we have some [HTML optimizations](#Optimization)\n",
1418-
"- You can only style the *values*, not the index or columns (except with `table_styles` above)\n",
1419-
"- You can only apply styles, you can't insert new HTML entities\n",
1420-
"\n",
1421-
"Some of these might be addressed in the future. "
1417+
"- You can only apply styles, you can't insert new HTML entities, except via subclassing."
14221418
]
14231419
},
14241420
{

0 commit comments

Comments
 (0)