Summary
I am using Python 2.7. I have a data frame with all categorical variables i.e. data type is string. I would like to transform unique row values of one column into multiple columns. Additionally, the values of those resulting columns must have the corresponding values from another column. To describe in detail, I have provided a reproducible data frame and expected output for your reference.
Dataframe that needs transposing can be created as follows:
import pandas as pd
codes = ['codeA','codeB', 'codeC']
variables = ['textA','textA','textB']
dataset = list(zip(codes,variables))
df = pd.DataFrame(data = dataset, columns=['codes','variables'])
df['string'] = 'string1'
The data frame that needs transposing looks like this:
df
codes variables string
0 codeA textA string1
1 codeB textA string1
2 codeC textB string1
The expected final output should like this:
textA textB string
codeA string1
codeB
codeC string1
Note: The objective is transposition. I am not overly concerned whether the blank spaces are NULL values or zeroes.

.T, however I don't think this is what you want. What do you mean by: "I would like to transform unique row values of one column into multiple columns."? Your expected output also makes no sense to me.