Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed May 26, 2021
2 parents 13793a2 + fd38824 commit 24223e5
Show file tree
Hide file tree
Showing 118 changed files with 1,957 additions and 916 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ repos:
types_or: [python, rst, markdown]
files: ^(pandas|doc)/
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.0.1
hooks:
- id: debug-statements
- id: end-of-file-fixer
exclude: \.txt$
- id: trailing-whitespace
- repo: https://github.com/cpplint/cpplint
rev: f7061b1 # the latest tag does not have the hook
rev: 1.5.5
hooks:
- id: cpplint
# We don't lint all C files because we don't want to lint any that are built
Expand Down Expand Up @@ -57,7 +57,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/asottile/pyupgrade
rev: v2.12.0
rev: v2.18.3
hooks:
- id: pyupgrade
args: [--py37-plus]
Expand All @@ -72,7 +72,7 @@ repos:
types: [text] # overwrite types: [rst]
types_or: [python, rst]
- repo: https://github.com/asottile/yesqa
rev: v1.2.2
rev: v1.2.3
hooks:
- id: yesqa
additional_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-38-numpydev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:

# pandas dependencies
- pytz
- pip=20.2
- pip
- pip:
- cython==0.29.21 # GH#34014
- "git+git://github.com/dateutil/dateutil.git"
Expand Down
Binary file added doc/source/_static/style/tg_ax0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/_static/style/tg_axNone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/_static/style/tg_axNone_gmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/_static/style/tg_axNone_lowhigh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/_static/style/tg_axNone_vminvmax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/_static/style/tg_gmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions doc/source/reference/style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Builtin styles
Styler.highlight_min
Styler.highlight_between
Styler.background_gradient
Styler.text_gradient
Styler.bar

Style export and import
Expand Down
2 changes: 2 additions & 0 deletions doc/source/user_guide/groupby.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@ instance method on each data group. This is pretty easy to do by passing lambda
functions:

.. ipython:: python
:okwarning:
grouped = df.groupby("A")
grouped.agg(lambda x: x.std())
Expand All @@ -1009,6 +1010,7 @@ arguments. Using a bit of metaprogramming cleverness, GroupBy now has the
ability to "dispatch" method calls to the groups:

.. ipython:: python
:okwarning:
grouped.std()
Expand Down
47 changes: 37 additions & 10 deletions doc/source/user_guide/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The pandas I/O API is a set of top level ``reader`` functions accessed like
text;Fixed-Width Text File;:ref:`read_fwf<io.fwf_reader>`
text;`JSON <https://www.json.org/>`__;:ref:`read_json<io.json_reader>`;:ref:`to_json<io.json_writer>`
text;`HTML <https://en.wikipedia.org/wiki/HTML>`__;:ref:`read_html<io.read_html>`;:ref:`to_html<io.html>`
text;`LaTeX <https://en.wikipedia.org/wiki/LaTeX>`__;;:ref:`Styler.to_latex<io.latex>`
text;`XML <https://www.w3.org/standards/xml/core>`__;:ref:`read_xml<io.read_xml>`;:ref:`to_xml<io.xml>`
text; Local clipboard;:ref:`read_clipboard<io.clipboard>`;:ref:`to_clipboard<io.clipboard>`
binary;`MS Excel <https://en.wikipedia.org/wiki/Microsoft_Excel>`__;:ref:`read_excel<io.excel_reader>`;:ref:`to_excel<io.excel_writer>`
Expand Down Expand Up @@ -1896,7 +1897,7 @@ Writing in ISO date format:
dfd = pd.DataFrame(np.random.randn(5, 2), columns=list("AB"))
dfd["date"] = pd.Timestamp("20130101")
dfd = dfd.sort_index(1, ascending=False)
dfd = dfd.sort_index(axis=1, ascending=False)
json = dfd.to_json(date_format="iso")
json
Expand Down Expand Up @@ -2830,7 +2831,42 @@ parse HTML tables in the top-level pandas io function ``read_html``.
.. |lxml| replace:: **lxml**
.. _lxml: https://lxml.de

.. _io.latex:

LaTeX
-----

.. versionadded:: 1.3.0

Currently there are no methods to read from LaTeX, only output methods.

Writing to LaTeX files
''''''''''''''''''''''

.. note::

DataFrame *and* Styler objects currently have a ``to_latex`` method. We recommend
using the `Styler.to_latex() <../reference/api/pandas.io.formats.style.Styler.to_latex.rst>`__ method
over `DataFrame.to_latex() <../reference/api/pandas.DataFrame.to_latex.rst>`__ due to the former's greater flexibility with
conditional styling, and the latter's possible future deprecation.

Review the documentation for `Styler.to_latex <../reference/api/pandas.io.formats.style.Styler.to_latex.rst>`__,
which gives examples of conditional styling and explains the operation of its keyword
arguments.

For simple application the following pattern is sufficient.

.. ipython:: python
df = pd.DataFrame([[1, 2], [3, 4]], index=["a", "b"], columns=["c", "d"])
print(df.style.to_latex())
To format values before output, chain the `Styler.format <../reference/api/pandas.io.formats.style.Styler.format.rst>`__
method.

.. ipython:: python
print(df.style.format("{}").to_latex())
XML
---
Expand Down Expand Up @@ -3648,15 +3684,6 @@ one can pass an :class:`~pandas.io.excel.ExcelWriter`.
df1.to_excel(writer, sheet_name="Sheet1")
df2.to_excel(writer, sheet_name="Sheet2")
.. note::

Wringing a little more performance out of ``read_excel``
Internally, Excel stores all numeric data as floats. Because this can
produce unexpected behavior when reading in data, pandas defaults to trying
to convert integers to floats if it doesn't lose information (``1.0 -->
1``). You can pass ``convert_float=False`` to disable this behavior, which
may give a slight performance improvement.

.. _io.excel_writing_buffer:

Writing Excel files to memory
Expand Down
24 changes: 19 additions & 5 deletions doc/source/user_guide/style.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,8 @@
" - [.highlight_min][minfunc] and [.highlight_max][maxfunc]: for use with identifying extremeties in data.\n",
" - [.highlight_between][betweenfunc] and [.highlight_quantile][quantilefunc]: for use with identifying classes within data.\n",
" - [.background_gradient][bgfunc]: a flexible method for highlighting cells based or their, or other, values on a numeric scale.\n",
" - [.bar][barfunc]: to display mini-charts within cell backgrounds.\n",
" - [.text_gradient][textfunc]: similar method for highlighting text based on their, or other, values on a numeric scale.\n",
" - [.bar][barfunc]: to display mini-charts within cell backgrounds.\n",
" \n",
"The individual documentation on each function often gives more examples of their arguments.\n",
"\n",
Expand All @@ -1022,6 +1023,7 @@
"[betweenfunc]: ../reference/api/pandas.io.formats.style.Styler.highlight_between.rst\n",
"[quantilefunc]: ../reference/api/pandas.io.formats.style.Styler.highlight_quantile.rst\n",
"[bgfunc]: ../reference/api/pandas.io.formats.style.Styler.background_gradient.rst\n",
"[textfunc]: ../reference/api/pandas.io.formats.style.Styler.text_gradient.rst\n",
"[barfunc]: ../reference/api/pandas.io.formats.style.Styler.bar.rst"
]
},
Expand Down Expand Up @@ -1098,14 +1100,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Background Gradient"
"### Background Gradient and Text Gradient"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can create \"heatmaps\" with the `background_gradient` method. These require matplotlib, and we'll use [Seaborn](https://stanford.edu/~mwaskom/software/seaborn/) to get a nice colormap."
"You can create \"heatmaps\" with the `background_gradient` and `text_gradient` methods. These require matplotlib, and we'll use [Seaborn](https://stanford.edu/~mwaskom/software/seaborn/) to get a nice colormap."
]
},
{
Expand All @@ -1120,19 +1122,31 @@
"df2.style.background_gradient(cmap=cm)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df2.style.text_gradient(cmap=cm)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[.background_gradient][bgfunc] has a number of keyword arguments to customise the gradients and colors. See its documentation.\n",
"[.background_gradient][bgfunc] and [.text_gradient][textfunc] have a number of keyword arguments to customise the gradients and colors. See the documentation.\n",
"\n",
"[bgfunc]: ../reference/api/pandas.io.formats.style.Styler.background_gradient.rst"
"[bgfunc]: ../reference/api/pandas.io.formats.style.Styler.background_gradient.rst\n",
"[textfunc]: ../reference/api/pandas.io.formats.style.Styler.text_gradient.rst"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Set properties\n",
"\n",
"Use `Styler.set_properties` when the style doesn't actually depend on the values. This is just a simple wrapper for `.applymap` where the function returns the same properties for all cells."
]
},
Expand Down
Loading

0 comments on commit 24223e5

Please sign in to comment.