Buyers ask: "how much does running the car more lower its price?" Train a LinearRegression on all rows with only km_driven_thousand as input and price_lakh as the answer.
km_driven_thousand is in thousands, so the slope is the change for 1,000 km. Store the price change for 10,000 km (in lakh), rounded to 2 decimals, in result.
import io
import pandas as pd
cars = pd.read_csv(io.StringIO("""car_id,age_years,km_driven_thousand,fuel,owners,price_lakh
1,5,32,Diesel,1,6.77
2,1,3,Petrol,1,8.59
3,2,11,Petrol,2,7.28
4,2,23,Petrol,1,7.17
5,4,37,Petrol,1,5.86
6,5,39,Diesel,1,6.68
7,6,74,Diesel,1,5.01
8,5,57,Diesel,1,6.00
9,7,68,Petrol,1,4.04
10,7,77,Diesel,2,4.41
11,3,37,Petrol,1,6.29
12,7,59,Petrol,3,4.12
13,1,11,Petrol,2,7.47
14,2,18,Petrol,1,7.34
15,11,113,Petrol,3,1.12
16,6,75,Diesel,1,5.24
17,7,77,Diesel,2,4.72
18,10,128,Petrol,1,2.01
19,1,3,Petrol,1,7.74
20,11,143,Diesel,2,2.17
21,8,95,Petrol,2,3.41
22,8,96,Petrol,1,3.27
23,3,46,Diesel,2,6.90
24,3,30,Petrol,1,7.01
25,1,17,Diesel,1,8.77
26,1,15,Petrol,1,8.07
27,11,101,Petrol,1,1.94
28,6,78,Petrol,1,4.17
29,11,136,Diesel,2,1.79
30,8,99,Petrol,2,3.11
31,5,56,Petrol,1,5.76
32,7,77,Petrol,1,4.60
33,5,60,Petrol,1,5.08
34,3,33,Diesel,1,7.18
35,2,29,Petrol,1,7.59
36,7,94,Diesel,1,4.62
37,6,57,Diesel,1,5.47
38,6,54,Diesel,1,5.88
39,3,38,Petrol,1,7.21
40,9,114,Petrol,2,2.84
41,9,125,Petrol,3,2.14
42,9,94,Petrol,1,2.47
43,11,97,Diesel,1,2.99
44,1,15,Diesel,1,9.08
45,10,90,Diesel,3,2.82
46,11,112,Petrol,2,1.03
47,4,44,Petrol,1,6.53
48,4,52,Petrol,1,6.23
49,2,19,Diesel,1,8.23
50,8,87,Diesel,1,4.03
51,2,34,Petrol,1,7.31
52,6,85,Diesel,2,5.18
53,8,87,Petrol,3,2.80
54,5,66,Diesel,1,6.06
55,11,104,Petrol,2,0.90
56,7,69,Petrol,1,4.79
57,9,126,Petrol,2,1.95
58,10,108,Petrol,1,2.34
59,5,67,Petrol,2,5.40
60,4,40,Petrol,2,6.04"""))Store your final answer in a variable named result.
Each hint gives a little more help. Try on your own first.
Run your code to see the output here.