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

df_games = pd.read_csv('../input/games.csv')

keep = ['id', 'rated', 'turns', 'victory_status', 'winner', 'increment_code', 'white_rating', 'black_rating', 'moves', 'opening_eco', 'opening_name', 'opening_ply']
df_games = df_games[keep]

df_minis = df_games[df_games['turns'] <= 30]
games = len(df_games.index)
minis = len(df_minis.index)
percent_minis = round(minis / games * 100, 2)

time_control_types = {'classic': {'start': 60, 'end': 999}, 'rapid': {'start': 11, 'end': 59}, 'blitz': {'start': 5, 'end': 10}, 'bullet': {'start': 0, 'end': 4}}
game_types = ['classic', 'rapid', 'blitz']
def get_time_control(minutes):
    if minutes >= time_control_types['classic']['start']:
        return 'classic'
    elif minutes >= time_control_types['rapid']['start']:
        return 'rapid'
    elif minutes >= time_control_types['blitz']['start']:
        return 'blitz'
    else:
        return 'bullet'
temp_df = df_games['increment_code'].str.split('+', n=1, expand=True)
temp_df[0] = temp_df[0].apply(lambda x: get_time_control(int(x)))
print(temp_df.head(10))