1

How to convert sklearn diabetes dataset into pandas DataFrame?

code:

import pandas as pd
from sklearn.datasets import load_diabetes

data = load_diabetes()
Tomer
  • 133
  • 1
  • 3
  • 9

1 Answers1

2

From the sklearn website. You can pass as_frame to specify a pandas dataframe. https://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_diabetes.html

data = load_diabetes(as_frame=True)

Derek
  • 48
  • 3
  • 1
    But if I do it there is a negative age: df.age.head() 0.038076 -0.001882 0.085299 -0.089063 0.005383 – Tomer Aug 17 '20 at 16:32
  • 2
    @Tomer that's true without turning it into the frame. i think you might need to research this dataset a little more before you run it with. – Paul H Aug 17 '20 at 16:39