@@ -11,7 +11,7 @@ DataFrame.read("input.csv")
11
11
12
12
Input string can be a file path or URL.
13
13
14
- ### Reading CSV
14
+ ## Reading CSV
15
15
16
16
All these calls are valid:
17
17
92
92
D: Int
93
93
```
94
94
95
- ### Reading JSON
95
+ ### Dealing with locale specific numbers
96
+
97
+ Sometimes columns in your CSV can be interpreted differently depending on your system locale.
98
+
99
+ <table >
100
+ <tr ><th >numbers</th ></tr >
101
+ <tr ><td >12,123</td ></tr >
102
+ <tr ><td >41,111</td ></tr >
103
+ </table >
104
+
105
+ Here comma can be decimal or thousands separator, thus different values.
106
+ You can deal with it in two ways
107
+
108
+ 1 ) Provide locale as a parser option
109
+
110
+ <!-- -FUN readNumbersWithSpecificLocale-->
111
+
112
+ ``` kotlin
113
+ val df = DataFrame .readCSV(
114
+ file,
115
+ parserOptions = ParserOptions (locale = Locale .UK ),
116
+ )
117
+ ```
118
+
119
+ <!-- -END-->
120
+
121
+ 2 ) Disable type inference for specific column and convert it yourself
122
+
123
+ <!-- -FUN readNumbersWithColType-->
124
+
125
+ ``` kotlin
126
+ val df = DataFrame .readCSV(
127
+ file,
128
+ colTypes = mapOf (" colName" to ColType .String )
129
+ )
130
+ ```
131
+
132
+ <!-- -END-->
133
+
134
+
135
+ ## Reading JSON
96
136
97
137
Basics for reading JSONs are the same: you can read from file or from remote URL.
98
138
@@ -160,7 +200,7 @@ D: Boolean?
160
200
Column A has ` String ` type because all values are string literals, no implicit conversion is performed. Column C
161
201
has ` Number ` type because it's the least common type for ` Int ` and ` Double ` .
162
202
163
- #### JSON Reading Options: Type Clash Tactic
203
+ ### JSON Reading Options: Type Clash Tactic
164
204
165
205
By default, if a type clash occurs when reading JSON, a new column group is created consisting of: "value", "array", and
166
206
any number of object properties:
@@ -211,7 +251,7 @@ For this case, you can set `typeClashTactic = JSON.TypeClashTactic.ANY_COLUMNS`
211
251
212
252
This option is also possible to set in the Gradle- and KSP plugin by providing ` jsonOptions ` .
213
253
214
- #### JSON Reading Options: Key/Value Paths
254
+ ### JSON Reading Options: Key/Value Paths
215
255
216
256
If you have some JSON looking like
217
257
@@ -302,7 +342,7 @@ Only the bracket notation of json path is supported, as well as just double quot
302
342
303
343
For more examples, see the "examples/json" module.
304
344
305
- ### Reading Excel
345
+ ## Reading Excel
306
346
307
347
Add dependency:
308
348
@@ -347,7 +387,7 @@ df1["IDS"].type() shouldBe typeOf<String>()
347
387
348
388
<!-- -END-->
349
389
350
- ### Reading Apache Arrow formats
390
+ ## Reading Apache Arrow formats
351
391
352
392
Add dependency:
353
393
0 commit comments