MujtabaNoori
New Contributor III

Hi @Abhimanyu ,
Yeah Actually in spark, '.'(dot) in columns is used for StructType by which the nested object can be accessed.
But definitely You can rename thE columns dynamically whichever has '.' in it.
Attached few screenshots for your reference that demonstrates the dropna(how='all') functionality for '.' columns without manual work

MujtabaNoori_0-1747745580276.png

 

MujtabaNoori_1-1747745586077.png

 

CODE FOR YOUR REFERENCE

cols = []
for col in df.columns:
    if '.' in col:
        renamedCol = col.replace('.','_')
        cols.append(f"`{col}` as {renamedCol}")
        continue
    cols.append(col)
df = df.selectExpr(*cols)