Reputation: 11
#Load dataset
from sklearn.datasets import load_breast_cancer
data = load_breast_cancer
When I run below command
data.keys()
It shows an error like this
AttributeError Traceback (most recent call last) in () ----> 1 data.keys()
AttributeError: 'function' object has no attribute 'keys'
Upvotes: 0
Views: 4965
Reputation: 3908
load_breast_cancer
is a function. With:
data = load_breast_cancer
You assign the function load_breast_cancer
to the variable data
, making the variable data
refer to the function load_breast_cancer
. If you want to get the data that the load_breast_cancer
function returns and put it in the variable data
, you have to call it like so:
data = load_breast_cancer()
Upvotes: 4