I am reading csv file with 350 columns all columns are type string. After reading into the Dataframe I want to substring all the columns values read form the csv file to a max of 1 to 100 characters while writing to a delta table. Can someone kindly guide me how to perform this task. Thanks
for field in df.schema.fields:
vField = df.collect()[0][field.name]
if vField != None:
field.name = vField[0:20]
It did not work.