I'm sorry for the dumb question, but how can I loa...
# datascience
e
I'm sorry for the dumb question, but how can I load a csv file in datalore kotlin?
a
You need to use a library. I think krangl or dataframe. something like
Copy code
%use dataframe
val frame = DataFrame.readCSV("Your url here")
e
Here they say:
When DataFrame is used within Jupyter Notebooks with Kotlin Kernel there is even more type safe way to access data. After every REPL line execution all new global variables of type
DataFrame
are analyzed and replaced with typed
DataFrame
wrapper with auto-generated extension properties for data access
I did
Copy code
%use dataframe

val url = "<https://raw.githubusercontent.com/robert-koch-institut/COVID-19-Impfungen_in_Deutschland/master/Aktuell_Deutschland_Landkreise_COVID-19-Impfungen.csv>"
val frame = DataFrame.readCSV(url)
but on
frame
I don't get accessor.. what's a "REPL line execution"?
a
You will get it in the next cell.
The thing is that Jupyter-kotlin uses staged compellation, so in order to get your custom accessors, you need to execute the cell first.
And of course you can work without fancy accessors, just get your column by their names or create column handlers manually
e
I just noticed, I can get them indeed in the next cell only. No way in the same cell, even with execution first. Also they do not appear with ctrl+space, I need to explicitly start writing them and then they get suggested
a
Yes, because, as I said there is a bit of magic involved to bring those dynamic accessors on statically-typed language
e
can I reference/import jvm classes, such as
LocalDate
?
Line_120.jupyter-kts (5:15 - 24) Unresolved reference: LocalDate
a
yes, you just need to add
import
statement to one of the cells.