Skip to content

Commit 6168765

Browse files
committed
Recommended changes to what's new
1 parent 9669d7d commit 6168765

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

doc/source/whatsnew/v0.20.0.txt

+13-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Highlights include:
1717
- Improved user API when accessing levels in ``.groupby()``, see :ref:`here <whatsnew_0200.enhancements.groupby_access>`
1818
- Improved support for ``UInt64`` dtypes, see :ref:`here <whatsnew_0200.enhancements.uint64_support>`
1919
- A new orient for JSON serialization, ``orient='table'``, that uses the :ref:`Table Schema spec <whatsnew_0200.enhancements.table_schema>`
20+
- Experimental support for exporting ``DataFrame.style`` formats to Excel , see :ref:`here <whatsnew_0200.enhancements.style_excel>`
2021
- Window Binary Corr/Cov operations now return a MultiIndexed ``DataFrame`` rather than a ``Panel``, as ``Panel`` is now deprecated, see :ref:`here <whatsnew_0200.api_breaking.rolling_pairwise>`
2122
- Support for S3 handling now uses ``s3fs``, see :ref:`here <whatsnew_0200.api_breaking.s3>`
2223
- Google BigQuery support now uses the ``pandas-gbq`` library, see :ref:`here <whatsnew_0200.api_breaking.gbq>`
@@ -403,7 +404,7 @@ To convert a ``SparseDataFrame`` back to sparse SciPy matrix in COO format, you
403404
Excel output for styled DataFrames
404405
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
405406

406-
Experimental support has been added to export ``DataFrame.style`` to Excel using the ``openpyxl`` engine. (:issue:`15530`)
407+
Experimental support has been added to export ``DataFrame.style`` formats to Excel using the ``openpyxl`` engine. (:issue:`15530`)
407408

408409
For example, after running the following, ``styled.xlsx`` renders as below:
409410

@@ -415,16 +416,24 @@ For example, after running the following, ``styled.xlsx`` renders as below:
415416
columns=list('BCDE'))],
416417
axis=1)
417418
df.iloc[0, 2] = np.nan
418-
df.style.\
419+
styled = df.style.\
419420
applymap(lambda val: 'color: %s' % 'red' if val < 0 else 'black').\
420421
apply(lambda s: ['background-color: yellow' if v else ''
421-
for v in s == s.max()]).\
422-
to_excel('styled.xlsx', engine='openpyxl')
422+
for v in s == s.max()])
423+
styled
424+
styled.to_excel('styled.xlsx', engine='openpyxl')
423425

424426
.. image:: _static/style-excel.png
425427

428+
.. ipython:: python
429+
:suppress:
430+
import os
431+
os.remove('styled.xlsx')
432+
426433
See the :ref:`Style documentation <style>` for more detail.
427434

435+
.. _whatsnew_0200.enhancements.intervalindex:
436+
428437
IntervalIndex
429438
^^^^^^^^^^^^^
430439

0 commit comments

Comments
 (0)