You are on page 1of 2

3/4/24, 10:57 PM Expt2.

ipynb - Colaboratory

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

df=pd.read_csv('/content/Automobile_data.csv')

df.head()

num-
normalized- fuel- body- drive- engine- wheel- engine- fuel-
symboling make aspiration of- ... bore stroke
losses type style wheels location base size system
doors

alfa-
0 3 ? gas std two convertible rwd front 88.6 ... 130 mpfi 3.47 2.68
romero

alfa-
1 3 ? gas std two convertible rwd front 88.6 ... 130 mpfi 3.47 2.68
romero

alfa-
2 1 ? gas std two hatchback rwd front 94.5 ... 152 mpfi 2.68 3.47
romero

3 2 164 audi gas std four sedan fwd front 99.8 ... 109 mpfi 3.19 3.4

4 2 164 audi gas std four sedan 4wd front 99.4 ... 136 mpfi 3.19 3.4

5 rows × 26 columns

df.shape

output (205, 26)

engine_size_data =df['engine-size']
type(engine_size_data)

pandas.core.series.Series
def __init__(data=None, index=None, dtype: Dtype | None=None, name=None, copy: bool=False, fastpath:
bool=False) -> None

One-dimensional ndarray with axis labels (including time series).

Labels need not be unique but must be a hashable type. The object
supports both integer- and label-based indexing and provides a host of
methods for performing operations involving the index. Statistical
methods from ndarray have been overridden to automatically exclude
i i d t ( tl t d )

np.mean(engine_size_data)

126.90731707317073

np.median(engine_size_data)

120.0

np.sort(engine_size_data)

array([ 61, 70, 70, 70, 79, 80, 90, 90, 90, 90, 90, 90, 90,
90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 92, 92, 92,
92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 97,
97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
98, 103, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
108, 108, 109, 109, 109, 109, 109, 109, 109, 109, 110, 110, 110,
110, 110, 110, 110, 110, 110, 110, 110, 110, 111, 119, 120, 120,
120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
130, 130, 130, 130, 131, 131, 132, 132, 134, 134, 136, 136, 136,
136, 136, 140, 140, 141, 141, 141, 141, 141, 141, 141, 145, 146,
146, 146, 146, 146, 146, 151, 152, 152, 152, 152, 152, 152, 156,
156, 156, 156, 156, 161, 164, 164, 164, 171, 171, 171, 173, 181,
181, 181, 181, 181, 181, 183, 183, 183, 183, 194, 194, 194, 203,
209, 209, 209, 234, 234, 258, 258, 304, 308, 326])

from scipy import stats


print(stats.mode(engine_size_data))

ModeResult(mode=92, count=15)

https://colab.research.google.com/drive/1KmV3jKqox4g-lW8UpRMq03RVhbJ0VYC9#printMode=true 1/2
3/4/24, 10:57 PM Expt2.ipynb - Colaboratory
np.std(engine_size_data)

41.54100172732021

np.var(engine_size_data)

1725.6548245092206

https://colab.research.google.com/drive/1KmV3jKqox4g-lW8UpRMq03RVhbJ0VYC9#printMode=true 2/2

You might also like