text_plain_output_1.png
import matplotlib.animation as animation

import matplotlib.pyplot as plt

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

data = pd.read_csv('/kaggle/input/aus-real-estate-sales-march-2019-to-april-2020/aus-property-sales-sep2018-april2020.csv')

data.dtypes

data_city_price = data[['city_name', 'price', 'property_type']]

import matplotlib.pyplot as plt
per = data_city_price.isnull().sum() / data.shape[0] * 100
per.plot.barh()

data_cp = data_city_price.dropna()
data_cp.shape

import seaborn as sns

fig_dims = (14, 10)
fig, ax = plt.subplots(figsize=fig_dims)
sns.barplot(x='city_name', y='price', hue='property_type', ax=ax, data=data_cp)
ax.set_xticklabels(ax.get_xticklabels(), rotation=90)
ax.set_xlabel('City')
ax.set_ylabel('Prices')
plt.show()

sydney = data[data['city_name'] == 'Sydney'][['date_sold', 'price', 'property_type']]
sydney.shape

sydney = sydney.dropna()
sydney.shape

sydney.sort_values('date_sold')

import matplotlib.animation as animation
Writer = animation.writers['ffmpeg']
writer = Writer(fps=20, metadata=dict(artist='akshita'), bitrate=1800)
fig = plt.figure(figsize=(10, 6))
plt.xlim(2017, 2021)
plt.ylim(np.min(sydney['price']), np.max(sydney['price']))
plt.xlabel('Year', fontsize=20)
plt.ylabel('Prices', fontsize=20)
plt.title('Prices per Year', fontsize=20)
def animate(i):
    d = sydney.iloc[:int(i + 1)]
    p = sns.lineplot(x=data.index, y=data['price'], data=d)
    p.tick_params(labelsize=17)
    plt.setp(p.lines, linewidth=7)
ani = animation.FuncAnimation(fig, animate, frames=60, repeat=True)
plt.show()