def index_encoding(sequences, letter_to_index_dict):
df = pandas.DataFrame(iter(s) for s in sequences)<EOL>result = df.replace(letter_to_index_dict)<EOL>return result.values<EOL>
Encode a sequence of same-length strings to a matrix of integers of the
same shape. The map from characters to integers is given by
`letter_to_index_dict`.

Given a sequence of `n` strings all of length `k`, return a `k * n` array where
the (`i`, `j`)th element is `letter_to_index_dict[sequence[i][j]]`.

Parameters
----------
sequences : list of length n of strings of length k
letter_to_index_dict : dict : string -> int

Returns
-------
numpy.array of integers with shape (`k`, `n`)