Q:

Clean the dataset and update the CSV file using python programming

belongs to collection: Python Pandas Exercises

0

Clean the dataset and update the CSV file

Replace all column values which contain ?n.a, or NaN.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

df = pd.read_csv("D:\\Python\\Articles\\pandas\\automobile-dataset\\Automobile_data.csv", na_values={
'price':["?","n.a"],
'stroke':["?","n.a"],
'horsepower':["?","n.a"],
'peak-rpm':["?","n.a"],
'average-mileage':["?","n.a"]})
print (df)

df.to_csv("D:\\Python\\Articles\\pandas\\automobile-dataset\\Automobile_data.csv")

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Find the most expensive car company name using pyt... >>
<< From the given dataset print the first and last fi...