# -*- coding: utf-8 -*-
"""Matplotlib example.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1wBuMDlex59naRUtITI_f7aiSURZ0UkGe
"""

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

cars_data = pd.read_csv("/content/Toyota.csv", index_col = 0,  na_values = ["??", "????"])

print(cars_data) #it reads index column from dataset as well

cars_data.dropna(axis=0, inplace=True) #to remove rows with NaN, axis=1 == columns, axis=0 == rows

#inplace is for ==> usually it forms temporary dataset after removal of NaN, inplace=True reflects changes in original dataset as well

cars_data

plt.scatter(cars_data["Age"], cars_data['Price'], color="black")
plt.title("Scatter plot for Price vs Age", color="yellow")
plt.xlabel("Age(Yrs)", color="yellow")
plt.ylabel("Price(USD)", color="yellow")
plt.yticks(color="white")
plt.xticks(color="white")
plt.show()

plt.hist(cars_data['KM'], color="green", edgecolor="white", bins=5)
plt.yticks(color="white")
plt.xticks(color="white")
plt.show()

counts=[5999, 9999, 19999]
fueltype=['petrol', 'diesel', 'Hybrid']
index = np.arange(len(fueltype))

plt.bar(index, counts, color = ['cyan', 'magenta', 'yellow'])
plt.title("Bar plots of fuel types",color="white" )
plt.xlabel("Fuel Type", color="white")
plt.ylabel("Frequency", color="white")
plt.yticks(color="white")
plt.xticks(color="white")
plt.show()

counts=[5999, 9999, 19999]
fueltype=['petrol', 'diesel', 'Hybrid']
index = np.arange(len(fueltype))

plt.bar(index, counts, color = ['cyan', 'magenta', 'yellow'])
plt.title("Bar plots of fuel types", color="white")
plt.xlabel("Fuel Type", color="cyan")
plt.ylabel("Frequency", color="cyan")
plt.xticks(index, fueltype, rotation=90, color="white")
plt.yticks(color="white")
plt.show()

