Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
6662d557
"include/LightGBM/vscode:/vscode.git/clone" did not exist on "9e89ee7fac7dfe18f0f4ab3ea7542854e3d0b936"
Unverified
Commit
6662d557
authored
Jul 10, 2024
by
Nikita Titov
Committed by
GitHub
Jul 09, 2024
Browse files
[tests][python] fix nan in pandas bool column (#6530)
parent
fc788a51
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
tests/python_package_test/test_engine.py
tests/python_package_test/test_engine.py
+2
-2
No files found.
tests/python_package_test/test_engine.py
View file @
6662d557
...
@@ -4156,9 +4156,9 @@ def test_pandas_nullable_dtypes(rng_fixed_seed):
...
@@ -4156,9 +4156,9 @@ def test_pandas_nullable_dtypes(rng_fixed_seed):
# introduce some missing values
# introduce some missing values
df
.
loc
[
1
,
"x1"
]
=
np
.
nan
df
.
loc
[
1
,
"x1"
]
=
np
.
nan
df
.
loc
[
2
,
"x2"
]
=
np
.
nan
df
.
loc
[
2
,
"x2"
]
=
np
.
nan
df
.
loc
[
3
,
"x4"
]
=
np
.
nan
# in recent versions of pandas, type 'bool' is incompatible with nan values in x4
# the previous line turns x3 into object dtype in recent versions of pandas
df
[
"x4"
]
=
df
[
"x4"
].
astype
(
np
.
float64
)
df
[
"x4"
]
=
df
[
"x4"
].
astype
(
np
.
float64
)
df
.
loc
[
3
,
"x4"
]
=
np
.
nan
y
=
df
[
"x1"
]
*
df
[
"x2"
]
+
df
[
"x3"
]
*
(
1
+
df
[
"x4"
])
y
=
df
[
"x1"
]
*
df
[
"x2"
]
+
df
[
"x3"
]
*
(
1
+
df
[
"x4"
])
y
=
y
.
fillna
(
0
)
y
=
y
.
fillna
(
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment