python- get column dataType from a dataframe
python- get column dataType from a dataframe I am trying to get a column data type from a dataframe Here is a sample code: print training_data.schema print 'fields' print training_data.schema.fields print 'names' print training_data.schema.names The above code prints as shown below: StructType(List(StructField(id,LongType,true),StructField(text,StringType,true),StructField(label,DoubleType,true))) fields [StructField(id,LongType,true), StructField(text,StringType,true), StructField(label,DoubleType,true)] names ['id', 'text', 'label'] But how can I get the datatype for label column ? Thanks a lot for your time. Regards check this,stackoverflow.com/questions/37335307/… – Suresh Jul 2 at 6:29 2 Answers 2 ...