Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: styler.render.encoding option #43177

Merged
merged 6 commits into from
Sep 1, 2021

Conversation

attack68
Copy link
Contributor

@attack68 attack68 commented Aug 23, 2021

This pandas option is added to allow the Styler options to be independent from the others. See #41395

  • add option
  • add tests
  • whats new
  • update function docstrings to_latex and to_html

will update styler user guide (do as a follow on).

encoding also applies to saving to files where appropriate, as well as HTML metatag

>>> df = pd.DataFrame([[1,2],[3,4]])

>>> print(df.style.to_html(doctype_html=True)[:76])
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">

>>> pd.options.styler.render.encoding = "ANSI"
>>> print(df.style.to_html(doctype_html=True)[:75])
<!DOCTYPE html>
<html>
<head>
<meta charset="ANSI">
<style type="text/css">

@attack68 attack68 changed the title WIP: ENH: styler.render.encoding option ENH: styler.render.encoding option Aug 29, 2021
@attack68 attack68 marked this pull request as ready for review August 29, 2021 07:14
@jreback jreback added the Styler conditional formatting using DataFrame.style label Aug 31, 2021
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, small comment and can you rebase

Character encoding setting for file output, and HTML meta tags,
defaults to "utf-8" if None.
Character encoding setting for file output, and HTML meta tags.
Defaults to ``pandas.options.styler.render.encoding`` value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would still say the default is utf8 (from the option)

…ption

# Conflicts:
#	doc/source/user_guide/options.rst
#	doc/source/whatsnew/v1.4.0.rst
#	pandas/core/config_init.py
@jreback jreback added this to the 1.4 milestone Sep 1, 2021
@jreback jreback merged commit 3e4a217 into pandas-dev:master Sep 1, 2021
@attack68 attack68 deleted the styler_encoding_option branch September 1, 2021 16:22
feefladder pushed a commit to feefladder/pandas that referenced this pull request Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Styler conditional formatting using DataFrame.style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants