The ord() function can be used to get the Unicode value of a specified character. e.g. ord("a")=97. However, you cannot apply the ord() function to the whole dataframe; you need to select one row/column at a time for the coversion.
Here is an example to show how to apply the ord() function on a dataframe. In this code, I am selecting one column at a time.
import pandas as pd
df = pd.DataFrame({'x': ['a', 'b', 'c', 'd', 'e'], 'y': ['f', 'g', 'h', 'i', 'j'], 'z': ['k', 'l', 'm', 'n', 'o']})
for c in df.columns:
df[c] = df[c].apply(ord)
print(df)
The above code will convert alphabets to their corresponding Unicode values and will print the following output:
x y z
0 97 102 107
1 98 103 108
2 99 104 109
3 100 105 110
4 101 106 111