text_html_output_1.png
import pandas as pd

dataset = pd.read_csv('/kaggle/input/arrests-for-marijuana-possession/Arrests.csv')

dataset.drop(dataset.columns[0], axis=1, inplace=True)

dataset['year'] = pd.to_datetime(dataset['year'], format='%Y').dt.year

dataset.isna().sum()

duplicated_entries_df = dataset[dataset.duplicated()]

cat_cols = dataset.select_dtypes(include=['object']).columns.tolist()
value_counts_df = pd.DataFrame(columns=['Column Name', 'Value', 'Count'])
for col in cat_cols:
    value_counts = dataset[col].value_counts().reset_index()
    value_counts.columns = ['Value', 'Count']
    value_counts['Column Name'] = col
    value_counts_df = pd.concat([value_counts_df, value_counts], ignore_index=True)

q1 = dataset['age'].quantile(0.25)
q3 = dataset['age'].quantile(0.75)
iqr = q3 - q1
lower_bound = q1 - 1.5 * iqr
upper_bound = q3 + 1.5 * iqr
outliers = dataset[(dataset['age'] < lower_bound) | (dataset['age'] > upper_bound)]
print('Outliers:\n', outliers)