text_html_output_1.png
import matplotlib.pyplot as plt

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

import seaborn as sns

df = pd.read_csv('../input/adverse-food-events/CAERS_ASCII_2004_2017Q2.csv')

df.shape

df.columns

df.rename(columns={'PRI_Reported Brand/Product Name': 'products_name', 'SYM_One Row Coded Symptoms': 'symptoms', 'CI_Gender': 'gender', 'CI_Age at Adverse Event': 'age', 'CI_Age Unit': 'age_unit', 'RA_Report #': 'no_report', 'RA_CAERS Created Date': 'created_date', 'AEC_Event Start Date': 'start_date', 'PRI_Product Role': 'products_role', 'PRI_FDA Industry Code': 'industry_code', 'AEC_One Row Outcomes': 'Outcomes', 'PRI_FDA Industry Name': 'products_types'}, inplace=True)
df.columns

df.duplicated('no_report').value_counts()

df.drop_duplicates('no_report', keep='last', inplace=True)
df.duplicated('no_report').value_counts()

plt.figure(figsize=(12, 15))
sns.set_style('ticks')
product = df['products_types'].sort_values(ascending=False)
sns.countplot(data=df, y=product)
plt.tight_layout()
plt.title('Reports by Industry\n', fontsize=20)
plt.yticks(fontsize=15)
plt.xticks(fontsize=15)
plt.show()
df.products_types.value_counts().sort_values(ascending=False)