Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
pandas.errors.SpecificationError \
pandas.errors.UndefinedVariableError \
pandas.read_json \
pandas.io.formats.style.Styler.to_latex \
pandas.read_parquet \
pandas.DataFrame.to_sql \
RET=$(($RET + $?)) ; echo $MSG "DONE"

Expand Down
21 changes: 12 additions & 9 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,11 +987,11 @@ def to_latex(
hide the repeated level-0 of the index:

>>> (styler.format(subset="Equity", precision=2)
... .format(subset="Stats", precision=1, thousands=",")
... .format(subset="Rating", formatter=str.upper)
... .format_index(escape="latex", axis=1)
... .format_index(escape="latex", axis=0)
... .hide(level=0, axis=0)) # doctest: +SKIP
... .format(subset="Stats", precision=1, thousands=",")
... .format(subset="Rating", formatter=str.upper)
... .format_index(escape="latex", axis=1)
... .format_index(escape="latex", axis=0)
... .hide(level=0, axis=0)) # doctest: +SKIP

Note that one of the string entries of the index and column headers is "H&M".
Without applying the `escape="latex"` option to the `format_index` method the
Expand All @@ -1003,12 +1003,15 @@ def to_latex(
recommendation:

>>> def rating_color(v):
... if v == "Buy": color = "#33ff85"
... elif v == "Sell": color = "#ff5933"
... else: color = "#ffdd33"
... if v == "Buy":
... color = "#33ff85"
... elif v == "Sell":
... color = "#ff5933"
... else:
... color = "#ffdd33"
... return f"color: {color}; font-weight: bold;"
>>> (styler.background_gradient(cmap="inferno", subset="Equity", vmin=0, vmax=1)
... .map(rating_color, subset="Rating")) # doctest: +SKIP
... .map(rating_color, subset="Rating")) # doctest: +SKIP

All the above styles will work with HTML (see below) and LaTeX upon conversion:

Expand Down
6 changes: 5 additions & 1 deletion pandas/io/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,9 @@ def read_parquet(
"""
Load a parquet object from the file path, returning a DataFrame.
The function automatically handles reading the data from a parquet file
and creates a DataFrame with the appropriate structure.
Parameters
----------
path : str, path object or file-like object
Expand Down Expand Up @@ -591,6 +594,7 @@ def read_parquet(
Returns
-------
DataFrame
DataFrame based on parquet file.
See Also
--------
Expand All @@ -600,7 +604,7 @@ def read_parquet(
--------
>>> original_df = pd.DataFrame(
... {{"foo": range(5), "bar": range(5, 10)}}
... )
... )
>>> original_df
foo bar
0 0 5
Expand Down