Pandas version checks
Reproducible Example
import pandas as pd
import warnings
def test():
warnings.warn("Some message")
def test2():
warnings.warn("Some message")
pd.DataFrame() # this call somehow affect
print(f"First case")
for _ in range(5):
test()
print(f"\nSecond case with constructing pandas.DataFrame")
for _ in range(5):
test2()
Issue Description
Looks like it change default filter for UserWarning to always or something similar.
Output of the reproducer:
First case
...\test_warnings2.py:6: UserWarning: Some message
warnings.warn("Some message")
Second case with constructing pandas.DataFrame
...\test_warnings2.py:9: UserWarning: Some message
warnings.warn("Some message")
...\test_warnings2.py:9: UserWarning: Some message
warnings.warn("Some message")
...\test_warnings2.py:9: UserWarning: Some message
warnings.warn("Some message")
...\test_warnings2.py:9: UserWarning: Some message
warnings.warn("Some message")
...\test_warnings2.py:9: UserWarning: Some message
warnings.warn("Some message")
Expected Behavior
I would expect the following output:
First case
...\test_warnings2.py:6: UserWarning: Some message
warnings.warn("Some message")
Second case with constructing pandas.DataFrame
Installed Versions
Details
pandas 2.1.2
Python 3.9.17
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
defaultfilter forUserWarningtoalwaysor something similar.Output of the reproducer:
Expected Behavior
I would expect the following output:
Installed Versions
Details