Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2022 02:56 AM
The way I solved it with more dynamically python was:
df = ...
cols = [(col[0], str(col[1])) for col in df.dtypes]
void_cols = [x[0] for x in cols if x[1] == 'void']
print(void_cols)
for col in void_cols:
df = df.withColumn(col, lit(None).cast('string'))