Check the values of train_new. You'll see that the columns mentionned are not of the expected types.

Another suggestion, i'm not sure of xgboost's handling of nulls. Might be that in those columns aswell.

Answer from Wizard_10101010 on Stack Exchange
🌐
GitHub
github.com › dmlc › xgboost › issues › 6039
AttributeError: 'DataFrame' object has no attribute 'feature_names' · Issue #6039 · dmlc/xgboost
August 20, 2020 - Created an xgboost model saved it in a pickle file and loading it to predict on a new dataset with the same features. Cannot perform prediction on the new data gives an error: AttributeError: 'DataFrame' object has no attribute 'feature_names'
Author   Rupam07
Discussions

AnnData Operations - AttributeError: 'DataFrame' object has no attribute 'dtype'
Examples of the error at 60 and 73. Hello I keep encountering the above error every time that I try to work with my concatenated file. Firstly it kept coming up when trying to flag mitochondrial genes and generate QC… More on help.galaxyproject.org
🌐 help.galaxyproject.org
5
0
August 7, 2024
pandas - AttributeError: 'DataFrame' object has no attribute 'dtype' appeared suddenly - Stack Overflow
Communities for your favorite technologies. Explore all Collectives · Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work More on stackoverflow.com
🌐 stackoverflow.com
AttributeError: 'DataFrame' object has no attribute 'dtype'
I am getting this more or less randomly: · To me the pandas.DataFrame (both X and X_train) looks good. Any idea why that would crash More on github.com
🌐 github.com
14
June 3, 2020
'DataFrame' object has no attribute 'dtype'
Describe the bug I believe my attached program is correct, but it errors out prematurely. with the error: DataFrame' object has no attribute 'dtype'. I've spent many hours trying to debug this. I k... More on github.com
🌐 github.com
1
December 30, 2022
🌐
Stack Exchange
datascience.stackexchange.com › questions › 118543 › xgb-dataframe-dtypes-error
pandas - XGB DataFrame.dtypes error - Data Science Stack Exchange
xgb_r = xg.XGBRegressor(objective ='reg:squarederror', booster='gbtree', n_estimators=350, max_depth=10, learning_rate=0.1) xgb_r.fit(train_X, train_y) ... DataFrame.dtypes for data must be int, float, bool or category.
🌐
Kaggle
kaggle.com › general › 108926
AttributeError: 'DataFrame' object has no attribute 'dtype' ...
Checking your browser before accessing www.kaggle.com · Click here if you are not automatically redirected after 5 seconds
🌐
GitHub
github.com › pycaret › pycaret › issues › 195
AttributeError: 'DataFrame' object has no attribute 'dtype' · Issue #195 · pycaret/pycaret
June 3, 2020 - I am getting this more or less randomly: X_train, X_test = train_test_split(X, stratify=X[target_antib]) exp_cip = setup(X_train, target_antib, feature_selection=False) To me the pandas.DataFrame (both X and X_train) looks good. Any idea...
Author   sorenwacker
🌐
GitHub
github.com › scikit-learn › scikit-learn › issues › 25261
'DataFrame' object has no attribute 'dtype' · Issue #25261 · scikit-learn/scikit-learn
December 30, 2022 - packages/sklearn/preprocessing/_function_transformer.py", line 177, in _check_inverse_transform if not np.issubdtype(X.dtype, np.number): The problem is X is a Pandas DataFrame, which does not have a dtype attribute.
Author   gerardkr
Find elsewhere
🌐
GitHub
github.com › dmlc › xgboost › issues › 9789
"ValueError: DataFrame.dtypes" upon calling XGBRegressor.fit(), but all columns are numeric · Issue #9789 · dmlc/xgboost
November 16, 2023 - File ~\Documents\WorkLocal\DataScience\GitHub\MixedEffectsRegressionDeliveryTimes\venv\lib\site-packages\xgboost\data.py:308, in _invalid_dataframe_dtype(data) 306 type_err = "DataFrame.dtypes for data must be int, float, bool or category." 307 msg = f"""{type_err} {_ENABLE_CAT_ERR} {err}""" --> 308 raise ValueError(msg) ValueError: DataFrame.dtypes for data must be int, float, bool or category. When categorical type is supplied, The experimental DMatrix parameterenable_categorical must be set to True. Invalid columns:market_id: object, store_id: object, store_primary_category: object, order_protocol: object
Author   AhmetZamanis
🌐
GitHub
github.com › pandas-dev › pandas › issues › 29135
combine_first: 'DataFrame' object has no attribute 'dtype' with duplicate columns · Issue #29135 · pandas-dev/pandas
October 21, 2019 - The above call results in AttributeError: 'DataFrame' object has no attribute 'dtype' which is difficult to interpret. Under the hood the set logic tries to maintain dtype but the duplicate column label results in finding a DataFrame instead of a Series.
Author   stippingerm
🌐
GitHub
github.com › rapidsai › cuml › issues › 6183
[KeyError: 'dtype' and AttributeError: DataFrame object has no attribute dtype when using cuML's ColumnTransformer with cuDF DataFrame] · Issue #6183 · rapidsai/cuml
December 16, 2024 - Describe the bug When using cuml's ColumnTransformer with a cuDF.DataFrame as input, the function raises a KeyError: 'dtype' and subsequently an AttributeError: 'DataFrame' object has no attribute dtype. This issue seems to occur when a ...
Author   allisond-nvidia
🌐
YouTube
youtube.com › watch
How to Fix the DataFrame Object Has No Attribute 'dtype' Error When Exporting to Stata Using Pandas - YouTube
Struggling with the `DataFrame` object has no attribute 'dtype' error in Pandas? Learn how to resolve this issue when exporting your dataset to Stata with th...
Published   April 10, 2025
Views   13
🌐
KNIME Community
forum.knime.com › knime analytics platform
AttributeError: 'DataFrame' object has no attribute 'dtype' - KNIME Analytics Platform - KNIME Community Forum
April 3, 2018 - Hello, I am not able to run the script in the python(1=>1) node. The same script is working in IDE like spyder. Below is my code and attached is screenshot of the workflow and the error: import re import pandas as pd output_table = input_table.copy() head = list(output_table) reg_2013 = re.compile("(Effort_2013).") reg_2012 = re.compile("(Effort_2012).") effort_2013 = list(filter(reg_2013.match, head)) effort_2012 = list(filter(reg_2012.match, head)) colname = data = for element i...
🌐
Stack Overflow
stackoverflow.com › questions › 67977854 › xgboost-error-dtypes-must-be-int-float-or-bool-but-they-are
python - xgboost error: dtypes must be int, float or bool, but they are - Stack Overflow
>> df.dtype OHE_Cat__x0_Single Family Residential Int64 OHE_Cat__x0_Townhouse Int64 OHE_Cat__x1_1 Int64 OHE_Cat__x1_2 Int64 ZIP OR POSTAL CODE Int64 PRICE Int64 BEDS Int64 BATHS Float64 SQUARE FEET Int64 LOT SIZE Int64 YEAR BUILT Int64 LATITUDE Float64 LONGITUDE Float64 Age Int64 TIME VAR UNIX Int64 is_Pandemic boolean is_CY boolean dtype: object · However when trying to fit my XGBRegressor, I get the following error: ValueError: DataFrame.dtypes for data must be int, float or bool.
🌐
Reddit
reddit.com › r/learnpython › attributeerror: 'dataframe' object has no attribute 'data'
r/learnpython on Reddit: AttributeError: 'DataFrame' object has no attribute 'data'
September 29, 2021 -
wine = pd.read_csv("combined.csv", header=0).iloc[:-1]
df = pd.DataFrame(wine)
df
dataset = pd.DataFrame(df.data, columns =df.feature_names)
dataset['target']=df.target
dataset

ERROR:

<ipython-input-27-64122078da92> in <module>
----> 1 dataset = pd.DataFrame(df.data, columns =df.feature_names)
      2 dataset['target']=df.target
      3 dataset

D:\Anaconda\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
   5463             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5464                 return self[name]
-> 5465             return object.__getattribute__(self, name)
   5466 
   5467     def __setattr__(self, name: str, value) -> None:

AttributeError: 'DataFrame' object has no attribute 'data'

I'm trying to set up a target to proceed with my Multi Linear Regression Project, but I can't even do that. I've already downloaded the CSV file and have it uploaded on a Jupyter Notebook. What I'm I doing wrong?

🌐
GitHub
github.com › pandas-dev › pandas › issues › 39520
BUG: AttributeError: type object 'object' has no attribute 'dtype' with numpy 1.20.x and pandas versions 1.0.4 and earlier · Issue #39520 · pandas-dev/pandas
February 1, 2021 - /usr/local/lib/python3.8/site-packages/pandas/core/dtypes/cast.py in construct_1d_arraylike_from_scalar(value, length, dtype) 1438 else: 1439 if not isinstance(dtype, (np.dtype, type(np.dtype))): -> 1440 dtype = dtype.dtype 1441 1442 if length and is_integer_dtype(dtype) and isna(value): AttributeError: type object 'object' has no attribute 'dtype' `
Author   Lucareful
🌐
Kaggle
kaggle.com › code › shubhampatil7 › dmproject
DMProject | Kaggle
November 16, 2023 - Explore and run machine learning code with Kaggle Notebooks | Using data from multiple data sources