-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Creating a pandas.DataFrame
affects warnings
filters
#55801
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
This is interesting, the repeated warnings only crop up when import pandas as pd
import warnings
def test():
warnings.warn('test warning')
def test2():
warnings.warn('test warning 2')
pd.DataFrame()
print('First warning')
for _ in range(5):
test()
print('Second warning')
for _ in range(5):
test2()
print('Testing first warning again')
for _ in range(5):
test() Output:
|
After some bisecting, #51917 is the PR that introduced this warning in the first place |
take |
This bug exists in the standard library [0]. It has a very interesting history and is due to the way that the Two options:
Would welcome discussion/comments on this [0] Known issue in cpython: cpython/issues/73858 |
@jrmylow Thanks for the research! The first option will require changing the code in many Python libraries (at least in all pandas dependencies). Let's try to find out first if there is any expected (nearest) time for solving this problem in python itself. I asked the author about this in python/cpython#8232. |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
Looks like it change
default
filter forUserWarning
toalways
or something similar.Output of the reproducer:
Expected Behavior
I would expect the following output:
Installed Versions
The text was updated successfully, but these errors were encountered: