Untitled5 1
Untitled5 1
C:\Users\Admin\AppData\Local\Temp\ipykernel_8268\551919226.py:1: Deprecati
onWarning:
Pyarrow will become a required dependency of pandas in the next major rele
ase of pandas (pandas 3.0),
(to allow more performant data types, such as the Arrow string type, and b
etter interoperability with other libraries)
but was not found to be installed on your system.
If this would cause problems for you,
please provide us feedback at https://github.com/pandas-dev/pandas/issues/
54466 (https://github.com/pandas-dev/pandas/issues/54466)
import pandas as pd
In [8]: iris.head()
localhost:8890/notebooks/Untitled5.ipynb 1/13
7/4/24, 7:37 PM Untitled5 - Jupyter Notebook
In [9]: iris.shape
Out[9]: (150, 6)
In [10]: iris.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 150 entries, 0 to 149
Data columns (total 6 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Id 150 non-null int64
1 SepalLengthCm 150 non-null float64
2 SepalWidthCm 150 non-null float64
3 PetalLengthCm 150 non-null float64
4 PetalWidthCm 150 non-null float64
5 Species 150 non-null object
dtypes: float64(4), int64(1), object(1)
memory usage: 7.2+ KB
In [12]: iris['Species'].value_counts()
Out[12]: Species
Iris-setosa 50
Iris-versicolor 50
Iris-virginica 50
Name: count, dtype: int64
In [8]: iris.isnull()
localhost:8890/notebooks/Untitled5.ipynb 2/13
7/4/24, 7:37 PM Untitled5 - Jupyter Notebook
In [9]: iris.isnull().sum()
Out[9]: Id 0
SepalLengthCm 0
SepalWidthCm 0
PetalLengthCm 0
PetalWidthCm 0
Species 0
dtype: int64
In [10]: iris.describe()
localhost:8890/notebooks/Untitled5.ipynb 3/13
7/4/24, 7:37 PM Untitled5 - Jupyter Notebook
In [11]: sns.pairplot(iris)
In [13]: features=list(iris.drop(['Species'],axis=1).columns)
target=['Species']
localhost:8890/notebooks/Untitled5.ipynb 4/13
7/4/24, 7:37 PM Untitled5 - Jupyter Notebook
--------------------------------------------------------------------------
-
ValueError Traceback (most recent call las
t)
Cell In[18], line 6
4 for i in (features):
5 c=features.index(i)+1
----> 6 plt.subplot(2,2,c)
7 sns.boxplot(y=iris[i].values,x=iris['Species']).set(ylabel=i)
File c:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packa
ges\matplotlib\pyplot.py:1425, in subplot(*args, **kwargs)
1422 fig = gcf()
1424 # First, search for an existing subplot with a matching spec.
-> 1425 key = SubplotSpec._from_subplot_args(fig, args)
1427 for ax in fig.axes:
1428 # If we found an Axes at the position, we can re-use it if the
user passed no
1429 # kwargs or if the axes class and kwargs are identical.
1430 if (ax.get_subplotspec() == key
1431 and (kwargs == {}
1432 or (ax._projection_init
1433 == fig._process_projection_requirements(**kwarg
s)))):
File c:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packa
ges\matplotlib\gridspec.py:599, in SubplotSpec._from_subplot_args(figure,
args)
597 else:
598 if not isinstance(num, Integral) or num < 1 or num > rows*col
s:
--> 599 raise ValueError(
600 f"num must be an integer with 1 <= num <= {rows*cols},
"
601 f"not {num!r}"
602 )
603 i = j = num
604 return gs[i-1:j]
localhost:8890/notebooks/Untitled5.ipynb 5/13
7/4/24, 7:37 PM Untitled5 - Jupyter Notebook
localhost:8890/notebooks/Untitled5.ipynb 6/13
7/4/24, 7:37 PM Untitled5 - Jupyter Notebook
In [21]: sns.boxplot(iris['SepalLengthCm'])
localhost:8890/notebooks/Untitled5.ipynb 7/13
7/4/24, 7:37 PM Untitled5 - Jupyter Notebook
In [20]: sns.pairplot(iris)
localhost:8890/notebooks/Untitled5.ipynb 8/13
7/4/24, 7:37 PM Untitled5 - Jupyter Notebook
In [23]: plt.figure(figsize=(5,5))
sns.heatmap(iris[features].corr(),annot=True,cbar=False)
plt.xticks(rotation=45)
plt.yticks(rotation=45)
plt.show()
In [24]: iris[features].corr()
localhost:8890/notebooks/Untitled5.ipynb 9/13
7/4/24, 7:37 PM Untitled5 - Jupyter Notebook
In [26]: sns.distplot(iris['SepalLengthCm'])
C:\Users\Admin\AppData\Local\Temp\ipykernel_8268\3880742695.py:1: UserWarn
ing:
For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751 (https://
gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751)
sns.distplot(iris['SepalLengthCm'])
localhost:8890/notebooks/Untitled5.ipynb 10/13
7/4/24, 7:37 PM Untitled5 - Jupyter Notebook
In [40]: X=iris.drop(['Species'],axis=1)
Y=iris['Species']
print(X,"\n\n",Y)
0 Iris-setosa
1 Iris-setosa
2 Iris-setosa
3 Iris-setosa
4 Iris-setosa
...
145 Iris-virginica
146 Iris-virginica
147 Iris-virginica
148 Iris-virginica
149 Iris-virginica
Name: Species, Length: 150, dtype: object
localhost:8890/notebooks/Untitled5.ipynb 11/13
7/4/24, 7:37 PM Untitled5 - Jupyter Notebook
Out[44]: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2])
Out[56]: (120, 5)
localhost:8890/notebooks/Untitled5.ipynb 12/13
7/4/24, 7:37 PM Untitled5 - Jupyter Notebook
accuracy 1.00 30
macro avg 1.00 1.00 1.00 30
weighted avg 1.00 1.00 1.00 30
In [ ]:
In [ ]:
localhost:8890/notebooks/Untitled5.ipynb 13/13