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
e2a3b125
Commit
e2a3b125
authored
May 29, 2018
by
Nikita Titov
Committed by
Guolin Ke
May 29, 2018
Browse files
added check for pandas DataFrame dimentions (#1402)
parent
af401561
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+2
-0
No files found.
python-package/lightgbm/basic.py
View file @
e2a3b125
...
...
@@ -239,6 +239,8 @@ PANDAS_DTYPE_MAPPER = {'int8': 'int', 'int16': 'int', 'int32': 'int',
def
_data_from_pandas
(
data
,
feature_name
,
categorical_feature
,
pandas_categorical
):
if
isinstance
(
data
,
DataFrame
):
if
len
(
data
.
shape
)
!=
2
or
data
.
shape
[
0
]
<
1
:
raise
ValueError
(
'Input data must be 2 dimensional and non empty.'
)
if
feature_name
==
'auto'
or
feature_name
is
None
:
data
=
data
.
rename
(
columns
=
str
)
cat_cols
=
data
.
select_dtypes
(
include
=
[
'category'
]).
columns
...
...
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