Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python] update DataTable handling #2020

Merged
merged 2 commits into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Python-Intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The LightGBM Python module can load data from:

- libsvm/tsv/csv/txt format file

- NumPy 2D array(s), pandas DataFrame, H2O DataTable, SciPy sparse matrix
- NumPy 2D array(s), pandas DataFrame, H2O DataTable's Frame, SciPy sparse matrix

- LightGBM binary file

Expand Down
12 changes: 6 additions & 6 deletions python-package/lightgbm/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def predict(self, data, num_iteration=-1,

Parameters
----------
data : string, numpy array, pandas DataFrame, H2O DataTable or scipy.sparse
data : string, numpy array, pandas DataFrame, H2O DataTable's Frame or scipy.sparse
Data source for prediction.
When data type is string, it represents the path of txt file.
num_iteration : int, optional (default=-1)
Expand Down Expand Up @@ -652,7 +652,7 @@ def __init__(self, data, label=None, reference=None,

Parameters
----------
data : string, numpy array, pandas DataFrame, H2O DataTable, scipy.sparse or list of numpy arrays
data : string, numpy array, pandas DataFrame, H2O DataTable's Frame, scipy.sparse or list of numpy arrays
Data source of Dataset.
If string, it represents the path to txt file.
label : list, numpy 1-D array, pandas Series / one-column DataFrame or None, optional (default=None)
Expand Down Expand Up @@ -1009,7 +1009,7 @@ def create_valid(self, data, label=None, weight=None, group=None,

Parameters
----------
data : string, numpy array, pandas DataFrame, H2O DataTable, scipy.sparse or list of numpy arrays
data : string, numpy array, pandas DataFrame, H2O DataTable's Frame, scipy.sparse or list of numpy arrays
Data source of Dataset.
If string, it represents the path to txt file.
label : list, numpy 1-D array, pandas Series / one-column DataFrame or None, optional (default=None)
Expand Down Expand Up @@ -1399,7 +1399,7 @@ def get_data(self):

Returns
-------
data : string, numpy array, pandas DataFrame, H2O DataTable, scipy.sparse, list of numpy arrays or None
data : string, numpy array, pandas DataFrame, H2O DataTable's Frame, scipy.sparse, list of numpy arrays or None
Raw data used in the Dataset construction.
"""
if self.handle is None:
Expand Down Expand Up @@ -2162,7 +2162,7 @@ def predict(self, data, num_iteration=None,

Parameters
----------
data : string, numpy array, pandas DataFrame, H2O DataTable or scipy.sparse
data : string, numpy array, pandas DataFrame, H2O DataTable's Frame or scipy.sparse
Data source for prediction.
If string, it represents the path to txt file.
num_iteration : int or None, optional (default=None)
Expand Down Expand Up @@ -2207,7 +2207,7 @@ def refit(self, data, label, decay_rate=0.9, **kwargs):

Parameters
----------
data : string, numpy array, pandas DataFrame, H2O DataTable or scipy.sparse
data : string, numpy array, pandas DataFrame, H2O DataTable's Frame or scipy.sparse
Data source for refit.
If string, it represents the path to txt file.
label : list, numpy 1-D array or pandas Series / one-column DataFrame
Expand Down
6 changes: 5 additions & 1 deletion python-package/lightgbm/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ class DataFrame(object):

"""datatable"""
try:
from datatable import DataTable
import datatable
if hasattr(datatable, "Frame"):
DataTable = datatable.Frame
else:
DataTable = datatable.DataTable
DATATABLE_INSTALLED = True
except ImportError:
DATATABLE_INSTALLED = False
Expand Down