Dataframe 0.12 Help

parse

Returns DataFrame in which given String columns are parsed into other types.

Special case of convert operation.

df.parse()

To parse only particular columns use column selector:

df.parse { age and weight }

parse tries to parse everyString column into one of supported types in the following order:

  • Int

  • Long

  • LocalDateTime

  • LocalDate

  • LocalTime

  • URL

  • Double

  • Boolean

  • BigDecimal

Available parser options:

  • locale: Locale is used to parse numbers

  • dateTimePattern: String is used to parse date and time

  • dateTimeFormatter: DateTimeFormatter is used to parse date and time

  • nullStrings: List<String> is used to treat particular strings as null value. Default null strings are "null" and "NULL"

df.parse(options = ParserOptions(locale = Locale.CHINA, dateTimeFormatter = DateTimeFormatter.ISO_WEEK_DATE))

You can also set global parser options that will be used by default in read, convert and parse operations:

DataFrame.parser.locale = Locale.FRANCE DataFrame.parser.addDateTimePattern("dd.MM.uuuu HH:mm:ss")
Last modified: 01 December 2023