Skip to content
Snippets Groups Projects
Commit d45a91cc authored by aslesha's avatar aslesha
Browse files

Upload New File

parent dbfd1b34
Branches
No related tags found
No related merge requests found
%% Cell type:code id: tags:
``` python
import csv
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
```
%% Cell type:code id: tags:
``` python
import pandas as pd
Automobile_data= pd.read_csv('Automobile_data.csv')
```
%% Cell type:code id: tags:
``` python
Automobile_data.head(n=5)
```
%% Output
index company body-style wheel-base length engine-type \
0 0 alfa-romero convertible 88.6 168.8 dohc
1 1 alfa-romero convertible 88.6 168.8 dohc
2 2 alfa-romero hatchback 94.5 171.2 ohcv
3 3 audi sedan 99.8 176.6 ohc
4 4 audi sedan 99.4 176.6 ohc
num-of-cylinders horsepower average-mileage price
0 four 111 21 13495.0
1 four 111 21 16500.0
2 six 154 19 16500.0
3 four 102 24 13950.0
4 five 115 18 17450.0
%% Cell type:code id: tags:
``` python
Automobile_data.tail(n=5)
```
%% Output
index company body-style wheel-base length engine-type \
56 81 volkswagen sedan 97.3 171.7 ohc
57 82 volkswagen sedan 97.3 171.7 ohc
58 86 volkswagen sedan 97.3 171.7 ohc
59 87 volvo sedan 104.3 188.8 ohc
60 88 volvo wagon 104.3 188.8 ohc
num-of-cylinders horsepower average-mileage price
56 four 85 27 7975.0
57 four 52 37 7995.0
58 four 100 26 9995.0
59 four 114 23 12940.0
60 four 114 23 13415.0
%% Cell type:code id: tags:
``` python
print('Maximum:', Automobile_data.price.max(),Automobile_data.company)
```
%% Output
Maximum: 45400.0 0 alfa-romero
1 alfa-romero
2 alfa-romero
3 audi
4 audi
5 audi
6 audi
7 bmw
8 bmw
9 bmw
10 bmw
11 bmw
12 bmw
13 chevrolet
14 chevrolet
15 chevrolet
16 dodge
17 dodge
18 honda
19 honda
20 honda
21 isuzu
22 isuzu
23 isuzu
24 jaguar
25 jaguar
26 jaguar
27 mazda
28 mazda
29 mazda
...
31 mazda
32 mercedes-benz
33 mercedes-benz
34 mercedes-benz
35 mercedes-benz
36 mitsubishi
37 mitsubishi
38 mitsubishi
39 mitsubishi
40 nissan
41 nissan
42 nissan
43 nissan
44 nissan
45 porsche
46 porsche
47 porsche
48 toyota
49 toyota
50 toyota
51 toyota
52 toyota
53 toyota
54 toyota
55 volkswagen
56 volkswagen
57 volkswagen
58 volkswagen
59 volvo
60 volvo
Name: company, Length: 61, dtype: object
%% Cell type:code id: tags:
``` python
Automobile_data.company.value_counts()
```
%% Output
toyota 7
bmw 6
nissan 5
mazda 5
volkswagen 4
audi 4
mitsubishi 4
mercedes-benz 4
chevrolet 3
alfa-romero 3
isuzu 3
jaguar 3
honda 3
porsche 3
dodge 2
volvo 2
Name: company, dtype: int64
%% Cell type:code id: tags:
``` python
index = np.arange(len(Automobile_data.company.value_counts()))
```
%% Cell type:code id: tags:
``` python
def plot_bar_x():
# this is for plotting purpose
index = np.arange(len(Automobile_data.company.value_counts()))
plt.bar(index, Automobile_data.company.value_counts())
plt.xlabel('company', fontsize=20)
plt.ylabel('No of cars', fontsize=20)
plt.xticks(index, Automobile_data.company.value_counts(), fontsize=5, rotation=30)
plt.title('company cars analysis')
plt.show()
```
%% Cell type:code id: tags:
``` python
plot_bar_x()
```
%% Output
%% Cell type:code id: tags:
``` python
import seaborn as sns
sns.set_style("darkgrid")
plt.plot(Automobile_data.company,Automobile_data.price)
plt.show()
```
%% Output
%% Cell type:code id: tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment