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

FutureWarning: Series.base is deprecated and will be removed in a future version #4300

Closed
justincart opened this issue Mar 27, 2019 · 11 comments · Fixed by #4337
Closed

FutureWarning: Series.base is deprecated and will be removed in a future version #4300

justincart opened this issue Mar 27, 2019 · 11 comments · Fixed by #4337

Comments

@justincart
Copy link

I am using python3.7.2 with xgboost 0.81 and got a lot of the following error messages:

/Users/jianhuitian/Documents/Programs/Anaconda3/anaconda3/lib/python3.7/site-packages/xgboost/core.py:587: FutureWarning: Series.base is deprecated and will be removed in a future version
if getattr(data, ‘base’, None) is not None

How to get rid of this annoying issue?

@thvasilo
Copy link
Contributor

I did a quick grep of the repo and cannot find the offending line if getattr(data, ‘base’, None) is not None, or any relevant reference to Series.base which originates from Pandas.

Not sure where why this warning pops up.

@jrathgeber
Copy link

Same issue

@astrowonk
Copy link
Contributor

astrowonk commented Apr 1, 2019

Getting the same warning.

The code is here:

        if getattr(data, 'base', None) is not None and \
           data.base is not None and isinstance(data, np.ndarray) \
           and isinstance(data.base, np.ndarray) and (not data.flags.c_contiguous):
            self.set_float_info_npy2d(field, data)
            return

From what I can tell about the history of the .base method it's a relic of deeper connections to numpy. I think simply replacing data.base with data.values.base would eliminated the warning and get the same result.

@hdinh
Copy link

hdinh commented Apr 5, 2019

Here's the code that produces this for me, it seems to be a combination of passing a pandas Series as the sample_weight.

import pandas as pd
import numpy as np
from xgboost import XGBClassifier

X = np.array([[0], [0], [1]])
y = np.array([0, 0, 1])
w = pd.Series([1, 1, 1])
clf = XGBClassifier()
clf.fit(X, y, w)

Looks like it's happening for pandas>=0.23.0 because the pandas Series.base property has been deprecated:
https://github.com/pandas-dev/pandas/blob/master/pandas/core/base.py#L779
from pandas-dev/pandas#20419

@yangjx12
Copy link

yangjx12 commented May 23, 2019

A simple way, ignore the warning.

import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

@H4dr1en
Copy link

H4dr1en commented May 23, 2019

A simple way, ignore the warning.

import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

Ignoring warnings should never be a solution

@trivialfis
Copy link
Member

Suggestions are welcomed. :-)

@hcho3
Copy link
Collaborator

hcho3 commented Jul 4, 2019

#4337 should eliminate FutureWarning

hcho3 pushed a commit that referenced this issue Jul 5, 2019
* Remove all references to data.base

Should eliminate the deprecation warning in issue #4300

* Fix lint
thesuperzapper pushed a commit to thesuperzapper/xgboost that referenced this issue Jul 8, 2019
* Remove all references to data.base

Should eliminate the deprecation warning in issue dmlc#4300

* Fix lint
sperlingxx pushed a commit to alipay/ant-xgboost that referenced this issue Jul 17, 2019
* Remove all references to data.base

Should eliminate the deprecation warning in issue dmlc#4300

* Fix lint
@songyang-dev
Copy link

songyang-dev commented Aug 16, 2019

Hi there, I am facing this same issue right now with the latest stable release of xgboost (0.9). I'm using an older version of python than the one used by OP. I have 3.6.8.

There is another warning message that keeps popping up. I will create a different issue for this.
image
EDIT: The other warning can be suppressed by doing what it is asking. That's what was suggested on another issue.

@hcho3
Copy link
Collaborator

hcho3 commented Aug 16, 2019

@XsongyangX 0.90 version was released on May 20, and the fix was made on July 4. So you'll see see the warning in 0.90. The next release (1.0.0) will not have the warning.

@trivialfis
Copy link
Member

Sorry, wrong click.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants