parser

inline fun <reified C> ConvertSchemaDsl<*>.parser(noinline parser: (String) -> C)

Defines how to convert String values into the given type C.

This method is a shortcut for convert<String>().with { }.

If no converter is defined for Char values, this converter will be used for them as well.

For more information: See convertTo on the documentation website.


Global counterpart of ParserOptions.

These options are used to configure how DataColumns of type String or String? should be parsed.

Settings changed here will affect the defaults for all parsing operations. You can always pass a ParserOptions object to functions that perform parsing, like tryParse, parse, convert, or even DataFrame.Companion.readCsv to override these options.

The default values are set by Parsers.resetToDefault.

Parsing date-time strings

DataFrame tries parsing date-time strings using

  • Custom global Kotlin-, and Java date-time formats, if provided;

  • Default Kotlin-, and Java ISO date-time formats.

You can customize this behavior by:

Finally, if a parsing function is provided with ParserOptions and ParserOptions.dateTime is not null, the global dateTimeLibrary parser option will be overridden.

Concretely, ParserOptions(dateTime = DateTimeParserOptions.Java) is equivalent to having DataFrame.parser.dateTimeLibrary = ParseDateTimeLibrary.JAVA for that particular function call.

In addition, if that DateTimeParserOptions has any custom formats or patterns, the custom- and default global formats will be ignored, allowing you to essentially override them.

For more information: See Global Parser Options on the documentation website.