text_plain_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

df = pd.read_csv('../input/chinas-population-by-gender-and-urbanrural/Chinas Population En.csv')

df.columns = ['year', 'total', 'male', 'female', 'urban', 'rural']
df.sort_values(by='year', ignore_index=True, inplace=True)

tmp_mask = df['total'] - df['male'] - df['female'] != 0
df[tmp_mask]

df.loc[tmp_mask, 'total'] = df.loc[tmp_mask, 'male'] + df.loc[tmp_mask, 'female']

plt.figure(figsize=(12, 5))
plt.title("Characteristics of China's  population over the period of 70 years", fontweight='bold', fontsize=12)
plt.plot(df['year'], df['female'], linewidth=3, label='female')
plt.plot(df['year'], df['male'], linewidth=3, label='male')
plt.plot(df['year'], df['urban'], linewidth=3, linestyle='--', label='urban')
plt.plot(df['year'], df['rural'], linewidth=3, linestyle='--', label='rural')
plt.xlabel('year', fontweight='bold', fontsize=10)
plt.ylabel('population', fontweight='bold', fontsize=10)
plt.grid(axis='x', color='0.95')
plt.legend(title='Features:')
plt.show()