Junior — Middle
How many features are contained in the provided dataset?
sobes.tech AI
Answer from AI
The number of features in a dataset is the number of columns used for training the model, excluding the target variable.
To determine the number of features in Python, you can use the pandas library:
import pandas as pd
data = pd.read_csv('data.csv')
# Assume the target variable is called 'target'
features = data.drop(columns=['target'])
print('Number of features:', features.shape[1])
If the target variable is not specified, then the number of features equals the number of columns in the DataFrame.