Created
January 28, 2018 12:36
-
-
Save vihar/debab263007a49aa95f9b80d8bf03d4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn import datasets | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
# Loading IRIS dataset from scikit-learn object into iris variable. | |
iris = datasets.load_iris() | |
# Prints the type/type object of iris | |
print(type(iris)) | |
# <class 'sklearn.datasets.base.Bunch'> | |
# prints the dictionary keys of iris data | |
print(iris.keys()) | |
# prints the type/type object of given attributes | |
print(type(iris.data), type(iris.target)) | |
# prints the no of rows and columns in the dataset | |
print(iris.data.shape) | |
# prints the target set of the data | |
print(iris.target_names) | |
# Load iris training dataset | |
X = iris.data | |
# Load iris target set | |
Y = iris.target | |
# Convert datasets' type into dataframe | |
df = pd.DataFrame(X, columns=iris.feature_names) | |
# Print the first five tuples of dataframe. | |
print(df.head()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment