enc = {'Category': {'a1': 1885.4403010060062,
'a2': 1072.0176453884112,
'a3': 1448.579447138836,
'a4': 1471.5656350474158,
'a5': 1232.3527616505146,
'a6': 891.9808067951503,
'a7': 1378.9613179304858}}
I have tried this.
for key, value in enc.items():
for k,v in value.items():
enc[value][k] = int(round(v))
I am getting this error:
TypeError: Invalid argument, not a string or column: 1885.4403010060062 of type <class 'float'>. For column literals, use 'lit', 'array', 'struct' or 'create_map' function.
I am looking for a final output like:
enc = {'Category': {'a1': 1885,
'a2': 1072,
'a3': 1448,
'a4': 1471,
'a5': 1232,
'a6': 891,
'a7': 1378}}
I am expecting the values to be rounded and then converted to integer.