Wpis z mikrobloga

#pyspark #awsglue #spark

Mam sobie kolumne z danymi:

60
null
null
null
null
35
4.594595
null
null

po wczytaniu wykrywa mi typ jako

|-- TestColumn: struct
| |-- string: string
| |-- long: long

No to wrzucilem sobie:

for column, data_type in df.dtypes:
____if data_type.startswith('struct'):
________df = df.withColumn(column, col(column).cast(StringType()))

(nie ma wcięć?)

Liczyłem, że dostanę 60, null, 35, 4.594595 a tu moim oczom w bazie ukazją się potworki

"{60, null}"
"{35, null}"
"{null, 4.594595}"

Jak to ogarnąc aby były normalne wyniki
Tzn. coczekuję 60, 35, 4.594595 lub ew. null
  • 1
  • Odpowiedz