-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcarClass.py
More file actions
70 lines (47 loc) · 2.12 KB
/
carClass.py
File metadata and controls
70 lines (47 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 17 19:42:00 2021
@author: Vukasin
"""
import pandas as pd
data = pd.read_csv('./Data/usedCleanedPre.csv')
# Get bradns
def get_brands():
return sorted(list(data['Marka'].unique()))
# Get models
def get_models(brend):
return sorted(list(data[data['Marka']==brend]['Model'].unique()))
# Get car types
def get_car_types(brend, model):
return list(data[(data['Model']==model) & (data['Marka']==brend)]['Karoserija'].unique())
# Get car year
def get_car_year(model):
return int(data[data['Model']==model]['Godiste'].min()), int(data[data['Model']==model]['Godiste'].max())
def get_car_mileage(model, year):
return int(data[(data['Model']==model) & (data['Godiste']==year)]['Kilometraza'].min()), int(data[(data['Model']==model) & (data['Godiste']==year)]['Kilometraza'].max())
# Get car volume
def get_car_volume(model, karoserija):
return sorted(list(data[(data['Model']==model) & (data['Karoserija']==karoserija)]['Kubikaza'].unique()))
# Get fuel type
def get_fuel_type(model, karoserija):
return list(data[(data['Model']==model) & (data['Karoserija']==karoserija)]['Gorivo'].unique())
# Get engine power
def get_engine_power(model, kubikaza):
return sorted(list(data[(data['Model']==model) & (data['Kubikaza']==kubikaza)]['Snaga motora'].unique()))
# Get car drive system
def get_drive(model, car_type):
return sorted(list(data[(data['Model']==model) & (data['Karoserija']==car_type)]['Pogon'].unique()))
# Get type of shift
def get_shift(model, car_type):
return sorted(list(data[(data['Model']==model) & (data['Karoserija']==car_type)]['Menjac'].unique()))
def get_emmision_class(model, year):
return sorted(list(data[(data['Model']==model) & (data['Godiste']==year)]['EKM'].unique()))
# Get car colors
def get_material():
return sorted(list(data['Materijal enterijera'].unique()))
# Get car colors
def get_colors():
return sorted(list(data['Boja'].unique()))
# Get car ac
def get_ac(model):
return sorted(list(data[(data['Model']==model)]['Klima'].unique()))