Skip to content

BUG: styler.format options and validator tests #43341

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

Merged
merged 11 commits into from
Sep 6, 2021

Conversation

attack68
Copy link
Contributor

@attack68 attack68 commented Sep 1, 2021

sorry, this is a fix for recent #43256.
the input types were not working using the instance factory approach so this is explicit.

@jreback jreback added the Styler conditional formatting using DataFrame.style label Sep 1, 2021
@jreback jreback added this to the 1.4 milestone Sep 1, 2021
@jreback
Copy link
Contributor

jreback commented Sep 1, 2021

cool, once more rebase pls.

…tions

# Conflicts:
#	pandas/tests/io/formats/style/test_format.py
@alimcmaster1
Copy link
Member

grr frequent network issues calling the conda repos hopefully #42580 helps with this.

Collecting package metadata (repodata.json): ...working... failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.

'https://repo.anaconda.com/pkgs/main/win-64'

@alimcmaster1
Copy link
Member

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@alimcmaster1 alimcmaster1 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -851,7 +857,7 @@ def register_converter_cb(key):
"format.formatter",
None,
styler_formatter,
validator=is_instance_factory([type(None), dict, callable, str]),
Copy link
Contributor

Choose a reason for hiding this comment

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

umm why doesn't this work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

x = '{:.2f}'

    def inner(x) -> None:
>       if not isinstance(x, _type):
E       TypeError: isinstance() arg 2 must be a type or tuple of types
x = <function <lambda> at 0x1251dd160>

    def inner(x) -> None:
>       if not isinstance(x, _type):
E       TypeError: isinstance() arg 2 must be a type or tuple of types

Also the signature of of the is_instance_factory struggles with callable:

>>> isinstance(lambda x: x, callable)
False
>>> isinstance(lambda x: x, type(callable))
False
>>> callable(lambda x: x)
True

Copy link
Contributor Author

@attack68 attack68 Sep 5, 2021

Choose a reason for hiding this comment

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

Ok fixed: callable != Callable !!!

@jreback jreback merged commit 703b1ef into pandas-dev:master Sep 6, 2021
feefladder pushed a commit to feefladder/pandas that referenced this pull request Sep 7, 2021
@attack68 attack68 deleted the bug_formatting_options branch September 7, 2021 15:47
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.

4 participants