0% found this document useful (0 votes)
6 views7 pages

Dataset Iris Flower. Final

The document is a report on data analysis using the Sklearn library with the Iris Flower Dataset, submitted by Hassan Mukhtiar for a programming course. It outlines objectives, procedures, and various tasks performed to manipulate and analyze the dataset, including loading data, slicing, and generating summary statistics. The conclusion emphasizes the successful application of Sklearn for data handling and manipulation, highlighting its importance in data analysis and machine learning.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views7 pages

Dataset Iris Flower. Final

The document is a report on data analysis using the Sklearn library with the Iris Flower Dataset, submitted by Hassan Mukhtiar for a programming course. It outlines objectives, procedures, and various tasks performed to manipulate and analyze the dataset, including loading data, slicing, and generating summary statistics. The conclusion emphasizes the successful application of Sklearn for data handling and manipulation, highlighting its importance in data analysis and machine learning.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

(CS-103L- Introduction to Programming for Data Science)

(Spring-2024)

Data analysis with Sklearn or Iris Flower Dataset


Report # 12

(CS-103L- Introduction to Programming for Data Science)

(Spring-2024)

Submitted By
Hassan Mukhtiar
(2023-BME-5)

Submitted To

Mr. Farhan Yousaf


Mr. Ali Noman

Department of Biomedical Engineering,


University of Engineering and Technology, Lahore,
New Campus

Department Biomedical Engineering


(CS-103L- Introduction to Programming for Data Science)
(Spring-2024)

Data analysis with Sklearn or Iris Flower Dataset


Report # 12
Objectives:
❖ To learn how to use Sklearn import datasets library and its functions.
❖ To learn how to load csv file into sklearn data frame and do the data manipulation.
❖ To learn how to use it for Iris data frame print from python.

Procedure:
❖ The Sklearn was first installed in the laptop.
❖ After that the Sklearn was imported as !pip install Sklearn, and the remaining code wrote on jupyter
notebook and run the code.
❖ Then, the following tasks were given to us to achieve the above objectives.

What is Sklearn?
Scikit-learn, often abbreviated as sklearn, is a Python library for machine learning. It offers a wide range of algorithms for
classification, regression, clustering, and dimensionality reduction tasks. Sklearn provides a consistent API, extensive
documentation, and integration with other Python libraries, making it a popular choice for data scientists and machine
learning practitioners.

Example:

Figure 1- Example of Sklearn.

Lab Tasks
Task:1

❖ Load _iris is a function from sklearn. The link provides documentation: the iris in your code will be a
dictionary-like object. X and y will be NumPy arrays, and names has the array of possible targets as text
(rather than numeric values as in y ).
❖ First, import datasets from Sklearn and this imported used as csv file.
❖ Datasets of Iris flower store in the Iris variable and then by using list to print in the form of list.

Department Biomedical Engineering


(CS-103L- Introduction to Programming for Data Science)
(Spring-2024)

Figure 2-Iris data keys.

Task: 2

❖ The iris data are a data frame of 150 measurements of iris petal and sepal lengths and widths, with 50
measurements for each species of “setosa,” “versicolor,” and “virginica.”
❖ Second, the task of this lab is to print the whole Iris flower data in the form of arrays.
❖ Then by using python code we also print the whole Iris flower data in the form of arrays.

Figure 3-Iris data.

Task:3

❖ There, target are label arrays corresponding to each point.


❖ If working with a csv file, load into the x each of the features of the iris dataset (sepal and petal length
and width) and load into y the column with the corresponding labels .
Department Biomedical Engineering
(CS-103L- Introduction to Programming for Data Science)
(Spring-2024)

Figure 4-Iris target.

Task:4

❖ In this task only print Iris names.

Figure 5- Iris target or type names.

Task:5

❖ By using python slice function, slicing the Iris data from 0 to 4 columns.

Figure 6-Iris Slicing data

Task:6

❖ By using python slice function, slicing the Iris data from 0 to 1 column and all rows of its data.

Department Biomedical Engineering


(CS-103L- Introduction to Programming for Data Science)
(Spring-2024)

Figure 7-Iris Slicing data

Task:7

❖ By using python slice function, slicing the Iris data from 0 to 2 columns and all rows of its data.

Figure 8-Iris Slicing data

Task:8

Department Biomedical Engineering


(CS-103L- Introduction to Programming for Data Science)
(Spring-2024)

• [:, 0] is a form of indexing or slicing. The colon : before the comma indicates that we want to include all rows
(samples) in the dataset, and 0 specifies that we want to select only the values in the first column of the dataset.

Figure 9-Iris Slicing data

Task:9
❖ [:, 0:] is a slicing notation.
❖ : in the first position indicates that we want to select all rows.
❖ 0: in the second position indicates that we want to select all columns starting from index 0.
❖ So, iris['data'][:, 0:] selects all rows and all columns starting from the first column (index 0).

Figure 10-Iris Slicing data

Task:10

❖ From this output, we can see summary statistics like the mean (average), standard deviation, minimum,
maximum, and various percentiles for each numerical column in the DataFrame.
❖ This is useful for quickly understanding the distribution and central tendency of the data.

Figure 11-Iris data frame


Department Biomedical Engineering
(CS-103L- Introduction to Programming for Data Science)
(Spring-2024)

Task:11

❖ It looks like we're working with the Iris dataset in Python, and we're trying to view the first few rows of the
dataset using the .head( ) method.
❖ This is a common operation when exploring datasets using libraries like pandas.

Figure 12- Iris data frame

Task:12

❖ The .tail() method in pandas is used to display the last few rows of a DataFrame.
❖ It's helpful for quickly inspecting the end of your dataset. If we're working with the Iris dataset, running iris.tail()
would show the last few rows of the dataset.

Figure 13- Iris data frame

Conclusion:
We concluded that Sklearn, we successfully imported the Iris dataset, performed data manipulation tasks, and printed
the resulting data frame in Python. This exercise provided valuable insights into utilizing Sklearn for dataset handling and
manipulation, essential skills for data analysis and machine learning workflows.

Department Biomedical Engineering

You might also like