text_plain_output_1.png
import pandas as pd

data = pd.read_csv('../input/attackincident/1.csv', nrows=3000, skiprows=range(1, 74732))

pd.options.display.max_info_columns = 200

data.drop(index=data[(data['iday'] < 1) | (data['iday'] > 31) | (data['imonth'] < 1) | (data['imonth'] > 12) | (data['iyear'] < 1998) | (data['iyear'] > 2017)].index, inplace=True)
data['date'] = data['iyear'].map(str) + '/' + data['imonth'].map(str) + '/' + data['iday'].map(str)
data['date'] = pd.to_datetime(data['date'])
data = data.reset_index(drop=True)

miss_list = data.columns[data.isnull().sum() > data.shape[0] * 1 / 4]
data.drop(miss_list, axis=1, inplace=True)

data_nf = data.copy()
for column in data.columns:
    if data.dtypes[column] == 'object':
        data[column] = pd.factorize(data[column])[0].astype(int)
data.info()