@@ -6,10 +6,7 @@ import org.jetbrains.kotlinx.dataframe.AnyFrame
6
6
import org.jetbrains.kotlinx.dataframe.AnyRow
7
7
import org.jetbrains.kotlinx.dataframe.DataColumn
8
8
import org.jetbrains.kotlinx.dataframe.DataFrame
9
- import org.jetbrains.kotlinx.dataframe.api.ParserOptions
10
- import org.jetbrains.kotlinx.dataframe.api.forEachRow
11
- import org.jetbrains.kotlinx.dataframe.api.toDataFrame
12
- import org.jetbrains.kotlinx.dataframe.api.tryParse
9
+ import org.jetbrains.kotlinx.dataframe.api.*
13
10
import org.jetbrains.kotlinx.dataframe.impl.ColumnNameGenerator
14
11
import org.jetbrains.kotlinx.dataframe.impl.api.Parsers
15
12
import org.jetbrains.kotlinx.dataframe.impl.api.parse
@@ -296,13 +293,22 @@ public fun DataFrame.Companion.readDelim(
296
293
return cols.toDataFrame()
297
294
}
298
295
299
- public fun AnyFrame.writeCSV (file : File , format : CSVFormat = CSVFormat .DEFAULT .withHeader()): Unit =
296
+ public fun AnyFrame.writeCSV (
297
+ file : File ,
298
+ format : CSVFormat = CSVFormat .DEFAULT
299
+ ): Unit =
300
300
writeCSV(FileWriter (file), format)
301
301
302
- public fun AnyFrame.writeCSV (path : String , format : CSVFormat = CSVFormat .DEFAULT .withHeader()): Unit =
302
+ public fun AnyFrame.writeCSV (
303
+ path : String ,
304
+ format : CSVFormat = CSVFormat .DEFAULT
305
+ ): Unit =
303
306
writeCSV(FileWriter (path), format)
304
307
305
- public fun AnyFrame.writeCSV (writer : Appendable , format : CSVFormat = CSVFormat .DEFAULT .withHeader()): Unit =
308
+ public fun AnyFrame.writeCSV (
309
+ writer : Appendable ,
310
+ format : CSVFormat = CSVFormat .DEFAULT
311
+ ) {
306
312
format.print (writer).use { printer ->
307
313
printer.printRecord(columnNames())
308
314
forEachRow {
@@ -316,8 +322,9 @@ public fun AnyFrame.writeCSV(writer: Appendable, format: CSVFormat = CSVFormat.D
316
322
printer.printRecord(values)
317
323
}
318
324
}
325
+ }
319
326
320
- public fun AnyFrame.toCsv (format : CSVFormat = CSVFormat .DEFAULT .withHeader() ): String =
327
+ public fun AnyFrame.toCsv (format : CSVFormat = CSVFormat .DEFAULT ): String =
321
328
StringWriter ().use {
322
329
this .writeCSV(it, format)
323
330
it
0 commit comments