Assume the below dataframe is having column "num" of 'object' type
num
0 0x11
1 0x3
2 0x05
3 0x4
4 0x1a
5 0x1d
6 0x82
The output of "print(df.dtypes)" is as:
Output:
num object
How to convert this object type column to Hex?
Expected Output: The output should be the same as the above mentioned 'df'. the type of the column 'num' should be changed to HEX.
I tried the below steps but not working:
df['num'] = [str(i) for i in df['num']]
df['num'] = [int(i,16) for i in df['num']]
df['num'] = [hex(i) for i in df['num']]