Remove FutureWarnings due to pandas 2.0 - #157
Conversation
pietrodantuono
left a comment
There was a problem hiding this comment.
The black formatting of tests/preprocessing/test_target_encoder.py is out of the scope of this pull request. I suggest to undo this formatting before going further with the PR.
Also, sometimes, specially in testing or when defining 2D arrays, you may want to avoid black formatting to compromise readability and conciseness, e.g.
# yapf (Google-like option)
df = pd.DataFrame({'variable': ['positive', 'positive', 'negative',
'neutral', 'negative', 'positive',
'negative', 'neutral', 'neutral',
'neutral', 'positive'],
'target': [5, 4, -5, 0, -4, 5, -5, 0, 1, 0, 4]})VS
# black
df = pd.DataFrame(
{
"variable": [
"positive",
"positive",
"negative",
"neutral",
"negative",
"positive",
"negative",
"neutral",
"neutral",
"neutral",
"positive",
],
"target": [5, 4, -5, 0, -4, 5, -5, 0, 1, 0, 4],
}
)To avoid for specific code chunks being automatically formatted by black, you can set:
# fmt: off
df = pd.DataFrame({'variable': ['positive', 'positive', 'negative',
'neutral', 'negative', 'positive',
'negative', 'neutral', 'neutral',
'neutral', 'positive'],
'target': [5, 4, -5, 0, -4, 5, -5, 0, 1, 0, 4]})
# fmt: onAlso, I see that there are more than one df.append commands in the tests. All of these will raise a FutureWarning, and if your intention is to get rid of them, these should be changed to pd.concat.
|
@pietrodantuono |
Story Title
Fixing FutureWarnings (#156)
Changes made
How does the solution address the problem
This PR will update the syntax
Comment
No test were written to automatically catch FutureWarnings. FutureWarnings are displayed by default so they are already shown when running the tests.
Linked issues
Resolves #156
Linked to #160