-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Export styler doesn't seem to include hide_index() #22851
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
Comments
Styler.export / Styler.use don't take into account attributes like So going forward, I would say
|
Thanks Tom. I wasn't sure, is there a simple workaround I should use in
the interim with hide_index? I wasn't sure if it can be done via one of the
set_* now as a kwarg. Not crucial but would be great to know and have
posted here when other people google for it.
Appreciate it,
Aaron
…On Thu, Sep 27, 2018 at 10:42 AM Tom Augspurger ***@***.***> wrote:
Styler.export / Styler.use don't take into account attributes like
self.hidden_index , precision, etc. Basically anything that can be set in
the constructor or one of the set_* (or I guess hide_*) methods. Some of
these probably should be exported, others (like uuid?) maybe shouldn't.
So going forward, I would say
1. figure out which attributes make sense to export
2. Add a parameter to Styler.export to control whether attributes
should be exported (False by default, for backwards compatibility)
3. Update Styler.export to
- copy self.todo
- add additional tasks for setting things like hidden index, (e.g., lambda
x: x.hide_index if hidden_index is True)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#22851 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APGbh9IFO8GoPk3AxlhsZhYrRwuklI5cks5ufOPtgaJpZM4W71XG>
.
|
The workaround for now is
|
linked to #40484 since simialr discussion/logic should probably be applied to what |
Im going to link this to #40675 and then close it so that thread can itemise this issue as well as keep track of similars |
Code Sample, a copy-pastable example if possible
Problem description
I'm trying to reuse a style for a second table, following the model in the docs at https://pandas.pydata.org/pandas-docs/stable/style.html#Sharing-Styles
I find that when I use my "option 1" above with red and hide index, the output for df styles as I would hope.
Note that the hide index seems empty when I print the styler, but it seems to know a second style is applied through the chaining.
When I then show df2, it has exported the red, but not the hide index.
If I repeat with "Option 2", the index is hidden for df but not df2
I think I'm doing this correctly given the docs, please let me know if I'm not calling it correctly or it is known that I can't export chained styles. If it's in the latter, is that in the documentation? I didn't see it.
Thanks, really appreciate all the effort on pandas,
Aaron
Note: We receive a lot of issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates!
I tried to check by searching issues, sorry if I missed it
Note: Many problems can be resolved by simply upgrading
pandas
to the latest version. Before submitting, please check if that solution works for you. If possible, you may want to check ifmaster
addresses this issue, but that is not necessary.I just did, see show_versions output
For documentation-related issues, you can check the latest versions of the docs on
master
here:https://pandas-docs.github.io/pandas-docs-travis/
If the issue has not been resolved there, go ahead and file it in the issue tracker.
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Linux
OS-release: 4.15.0-34-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.23.4
pytest: None
pip: 9.0.3
setuptools: 39.0.1
Cython: None
numpy: 1.14.3
scipy: None
pyarrow: None
xarray: None
IPython: 6.3.1
sphinx: None
patsy: None
dateutil: 2.7.2
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.2
openpyxl: None
xlrd: 1.1.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: