text_plain_output_1.png
from sklearn.preprocessing import LabelEncoder

import matplotlib.pyplot as plt

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

import seaborn as sns

train = pd.read_csv('../input/scrabble-point-value/turns_train.csv')
tests = pd.read_csv('../input/scrabble-point-value/turns_test.csv')
games = pd.read_csv('../input/scrabble-point-value/games.csv')
sample_submission = pd.read_csv('../input/scrabble-point-value/sample_submission.csv')
scores = pd.read_csv('../input/scrabble-point-value/scores.csv')

betterBot2 = train[(train.nickname == 'BetterBot') & (train.turn_number < 21) & (train.game_id < 5000) & (train.turn_type == 'Play')]
betterBot2 = betterBot2.drop(['nickname', 'game_id', 'turn_type'], 1)
betterBot2

scrabble_points = {'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1, 'J': 8, 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, 'S': 1, 'T': 1, 'U': 1, 'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 5, '?': 0, '(': 0, ')': 0, '.': 0}

for index in betterBot2.index:
    code = 0
    codeMove = 0
    if isinstance(betterBot2.loc[index, 'rack'], str):
        for letter in betterBot2.loc[index, 'rack']:
            code += scrabble_points[letter]
        betterBot2.loc[index, 'rack'] = int(code)
    if isinstance(betterBot2.loc[index, 'move'], str):
        for letter in betterBot2.loc[index, 'move']:
            codeMove += scrabble_points[letter.upper()]
        betterBot2.loc[index, 'move'] = int(codeMove)

betterBot2 = betterBot2[betterBot2.move.isnull() == False]

betterBot2.rack = betterBot2.rack.astype(int)
betterBot2.move = betterBot2.move.astype(int)

from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
le.fit(betterBot2.location.astype(str).sort_values())
betterBot2.location = le.transform(betterBot2.location)

corr_bb = betterBot2.corr()
plt.figure(figsize=(14, 12))
sns.heatmap(corr_bb, annot=True)
plt.show()