image_output_1.png
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

df_train = pd.read_csv('../input/train.csv')
df_test = pd.read_csv('../input/test.csv')

list(df_train.columns)

df_train.isna().sum()

df_train.isnull().any().any()

df_train1 = df_train.drop(['belongs_to_collection'], axis=1)
df_test = df_test.drop(['belongs_to_collection'], axis=1)

df_train['logRevenue'] = np.log1p(df_train['revenue'])

df_train[['release_month', 'release_day', 'release_year']] = df_train['release_date'].str.split('/', expand=True).replace(np.nan, -1).astype(int)
df_train.loc[(df_train['release_year'] <= 19) & (df_train['release_year'] < 100), 'release_year'] += 2000
df_train.loc[(df_train['release_year'] > 19) & (df_train['release_year'] < 100), 'release_year'] += 1900
releaseDate = pd.to_datetime(df_train['release_date'])
df_train['release_dayofweek'] = releaseDate.dt.dayofweek
df_train['release_quarter'] = releaseDate.dt.quarter

plt.figure(figsize=(25, 15))
sns.countplot(df_train['release_year'].sort_values())
plt.title('Movie Release count by Year', fontsize=25)
loc, labels = plt.xticks()
plt.xticks(fontsize=15, rotation=90)
plt.show()