-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_car.py
More file actions
27 lines (21 loc) · 712 Bytes
/
Copy pathtest_car.py
File metadata and controls
27 lines (21 loc) · 712 Bytes
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
import os
import pytest
import Car
import pandas as pd
def test_score():
df = pd.read_csv('Data/ksl.csv')
originalLength = df.size
for index, row in df.iterrows():
car = Car.Car()
car.setPrice(row["Price"])
car.setMiles(row["Mileage"])
car.setYear(row["Year"])
car.setBrand(row["Make"])
car.setScore()
df.loc[index, "Score"] = car.score
assert car.score > 0
df.Score = df.Score.astype(float)
df = df.sort_values(["Score", "Price"], ascending=False)
df = df.drop_duplicates(["Year", "Make", "Model", "Price", "Mileage"])
df.to_csv("Data/ksl.csv", mode='w', index=False)
os.system('start "excel.exe" "ksl.csv"')