1
1
[ // ] : # ( title: parse )
2
2
<!-- -IMPORT org.jetbrains.kotlinx.dataframe.samples.api.Modify-->
3
3
4
- Returns a [ ` DataFrame ` ] ( DataFrame.md ) in which the given ` String ` columns are parsed into other types.
4
+ Returns a [ ` DataFrame ` ] ( DataFrame.md ) in which the given ` String ` and ` Char ` columns are parsed into other types.
5
5
6
- This is a special case of the [ convert ] ( convert.md ) operation.
6
+ This is a special case of the [ ] ( convert.md ) operation.
7
7
8
8
This parsing operation is sometimes executed implicitly, for example, when [ reading from CSV] ( read.md ) or
9
- [ type converting from ` String ` columns] ( convert.md ) .
9
+ [ type converting from ` String ` / ` Char ` columns] ( convert.md ) .
10
10
You can recognize this by the ` locale ` or ` parserOptions ` arguments in these functions.
11
11
12
12
Related operations: [ ] ( updateConvert.md )
@@ -20,7 +20,10 @@ df.parse()
20
20
<inline-frame src =" resources/org.jetbrains.kotlinx.dataframe.samples.api.Modify.parseAll.html " width =" 100% " />
21
21
<!-- -END-->
22
22
23
- To parse only particular columns use a [ column selector] ( ColumnSelectors.md ) :
23
+ When no columns are specified, all ` String ` and ` Char ` columns are parsed,
24
+ even those inside [ column groups] ( DataColumn.md#columngroup ) and inside [ frame columns] ( DataColumn.md#framecolumn ) .
25
+
26
+ To parse only particular columns, use a [ column selector] ( ColumnSelectors.md ) :
24
27
25
28
<!-- -FUN parseSome-->
26
29
@@ -33,7 +36,7 @@ df.parse { age and weight }
33
36
34
37
### Parsing Order
35
38
36
- ` parse ` tries to parse every ` String ` column into one of supported types in the following order:
39
+ ` parse ` tries to parse every ` String ` / ` Char ` column into one of the supported types in the following order:
37
40
* ` Int `
38
41
* ` Long `
39
42
* ` Instant ` (` kotlin.time ` ) (requires ` parseExperimentalInstant = true ` , available from Kotlin 2.1+.)
@@ -48,6 +51,12 @@ df.parse { age and weight }
48
51
* ` Uuid ` ([ ` kotlin.uuid.Uuid ` ] ( https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.uuid/-uuid/ ) ) (requires ` parseExperimentalUuid = true ` )
49
52
* ` BigDecimal `
50
53
* ` JSON ` (arrays and objects) (requires the ` org.jetbrains.kotlinx:dataframe-json ` dependency)
54
+ * ` Char `
55
+ * ` String `
56
+
57
+ When ` .parse() ` is called on a single column and the input (` String ` /` Char ` ) type is the same as the output type,
58
+ (a.k.a., it cannot be parsed further) an ` IllegalStateException ` is thrown.
59
+ To avoid this, use ` col.tryParse() ` instead.
51
60
52
61
### Parser Options
53
62
0 commit comments