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 numbersdateTimePattern: String
is used to parse date and timedateTimeFormatter: DateTimeFormatter
is used to parse date and timenullStrings: List<String>
is used to treat particular strings asnull
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: 29 March 2024