Hi friends! Can someone shed a light into this, pl...
# datascience
p
Hi friends! Can someone shed a light into this, please? 😊 Consider the following code:
Copy code
val profileOptions = ParserOptions(
    locale = Locale.UK,
    dateTimePattern = "MM-dd-yyyy",
)

val profileTypes = mapOf(
    "Date" to ColType.LocalDate,
    "Network" to ColType.String,
    "Audience" to ColType.Int,
)

DataFrame.readCSV("profile.csv", parserOptions = profileOptions, colTypes = profileTypes)
The
.csv
I have has comma as group separator/thousand separator (that's why I went for
Locale.UK
). If I don't specify the type for
Audience
, DataFrame infers it's a
Double
, then later I can convert it to
Int
. I was trying to specify
Int
as column type to save me one conversion, but it seems the locale is not considered:
Copy code
Exception in thread "main" java.lang.IllegalStateException: Couldn't parse '52,487' into type kotlin.Int
I can live with an extra
.convert { ... }
line to convert this double to int, but I was wondering if I missed something here (or if it's not possible at all). Any ideas are welcome! Thanks! gratitude thank you
r
Sorry in the UK we use . as a decimal separator, like 123,456.789 (though reading the rest I assume you meant digit group separator)
gratitude thank you 2
😅 1
p
@ross_a oopsie, you are right! 😅 I meant group separator. I always get confused! Thanks! gratitude thank you
👍 1