Skip to content

Commit 1a5002c

Browse files
committed
fixed crash for empty csv
1 parent 13d4fe1 commit 1a5002c

File tree

1 file changed

+1
-1
lines changed
  • core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io

1 file changed

+1
-1
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/csv.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ public fun DataFrame.Companion.readDelim(
345345
}
346346

347347
val columnNames = csvParser.headerNames.takeIf { it.isNotEmpty() }
348-
?: (1..records[0].count()).map { index -> "X$index" }
348+
?: (1..(records.firstOrNull()?.count() ?: 0)).map { index -> "X$index" }
349349

350350
val generator = ColumnNameGenerator()
351351
val uniqueNames = columnNames.map { generator.addUnique(it) }

0 commit comments

Comments
 (0)