Commit 82fcfa0e authored by wxchan's avatar wxchan Committed by Guolin Ke
Browse files

fix warning; fix doc bug (#232)

parent a2ae8384
[](For bugs and unexpected issues, please provide the following information, so that we could reproduce in our system)
Please search your question on previous issues, stackoverflow or other search engines before you open a new one.
For bugs and unexpected issues, please provide following information, so that we could reproduce on our system.
## Environment info
Operating System:
CPU:
C++/Python/R version:
## Error Message:
## Reproducible examples
## Steps to reproduce
......
......@@ -78,13 +78,13 @@ LightGBM can use categorical features as input directly. It doesn't need to cove
#### Weights can be set when needed:
```python
w = np.random.rand(500, 1)
w = np.random.rand(500, )
train_data = lgb.Dataset(data, label=label, weight=w)
```
or
```python
train_data = lgb.Dataset(data, label=label)
w = np.random.rand(500, 1)
w = np.random.rand(500, )
train_data.set_weight(w)
```
......
......@@ -222,7 +222,7 @@ 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 feature_name == 'auto' or feature_name is None:
data.rename(columns=str, inplace=True)
data = data.rename(columns=str)
cat_cols = data.select_dtypes(include=['category']).columns
if pandas_categorical is None: # train dataset
pandas_categorical = [list(data[col].cat.categories) for col in cat_cols]
......@@ -241,7 +241,7 @@ def _data_from_pandas(data, feature_name, categorical_feature, pandas_categorica
if categorical_feature == 'auto':
categorical_feature = list(cat_cols)
else:
categorical_feature += list(cat_cols)
categorical_feature = list(categorical_feature) + list(cat_cols)
if feature_name == 'auto':
feature_name = list(data.columns)
data_dtypes = data.dtypes
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment