Skip to content

Commit

Permalink
added check for pandas DataFrame dimentions (#1402)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS authored and guolinke committed May 29, 2018
1 parent af40156 commit e2a3b12
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python-package/lightgbm/basic.py
Expand Up @@ -239,6 +239,8 @@ def c_int_array(data):

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
Expand Down

0 comments on commit e2a3b12

Please sign in to comment.