Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Actually I created an issue on GitHub.
    Jordan R A

    Hello everyone,

    I thought I might as well try here first before making an issue. I have a relatively simple question -- what is the simplest way to append rows to DataFrames?

    In short what I'm trying to do: I want Pandas' append functionality: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.append.html

    I understand DataFrames are immutable, so I'd ultimately be creating a new DataFrame in the end. However, the only way I've seen so far to create such a DataFrame is to create a row iterable, and feed that into another dataFrameOf like so:

        val frame: DataFrame = dataFrameOf("Col1", "Col2") (
            "A", "B"
        val newFrame: DataFrame = dataFrameOf("Col1", "Col2") (
            frame.rows.asSequence().map { it.values }.flatten() + sequenceOf("C", "D")
     * A DataFrame: 2 x 2
     *     Col1   Col2
     * 1      A      B
     * 2      C      D

    This seems particularly ugly (not to mention that the items may be in the wrong order...) There must be a better way, surely?

    Jordan R A
    Hmm, I'll make an issue :)
    And hopefully a pull request.
    Holger Brandl
    Answer posted under the holgerbrandl/krangl#76
    Hello, does krangl have a cumsum (cumulative sum) function?
    Holger Brandl
    Hey @grahamdaley , sure there is, see holgerbrandl/krangl@51a3956 and in particular the test for some guidance on usage. Feel welcome if you have other questions or comments.
    Mikael Gueck
    With jupyterlab + the Kotlin kernel + krangl + kravis, for some reason, kravis always opens a new window when showing the graph, instead of embedding it into the Jupyter notebook results. Any workaround?
    Holger Brandl
    It should autodetect that it is running in a jupypter env. However the detection logic might be no longer valid, see https://github.com/holgerbrandl/kravis/blob/7a46b57ec1e467d1ce9ca8b1ac32f19fff8b5ae8/src/main/kotlin/kravis/GGPlot2.kt#L24
    Could you try to force jupyter as output mode by settings
    SessionPrefs.OUTPUT_DEVICE = JupyterDevice()
    In addition support is suboptimal because of Kotlin/kotlin-jupyter#12 which you may want to vote for.

    Hello everyone, I'm very new to using Kotlin and Krangl so this might be really obvious, but after implementing Krangl by using implementation "de.mpicbg.scicomp:krangl:0.13" in build.gradle (Module:app), I get a CONFIGURE SUCCESSFUL. But after running the app, I get an error:

    Task :app:mergeExtDexDebug FAILED
    'Method name '=' in class 'krangl.Extensions' cannot be represented in dex format.

    Even after commenting out the function imports and where I've used the functions. The only way to get rid of this error is to remove the implementation... What's happening? Any tips/help is much appreciated!

    Where I implemented Krangl: https://github.com/AngieTanesha/viscosity-calculator/blob/master/app/build.gradle
    Functions used: https://github.com/AngieTanesha/viscosity-calculator/blob/master/app/src/main/java/com/angiemochie/viscositycalculator/vi.kt

    Holger Brandl
    Indeed @AngieTanesha this is a known problem. See https://discuss.kotlinlang.org/t/android-issue-with-backticked-method-names/66. Not sure how to deal with it.
    When anyone's online: I have a short question regarding column types. Is there any way to cast a DataCol (e.g. a StringCol) to a different type of DataCol (e.g. an IntCol)?
    I couldn't find anything in the docs. Any help is appreciated!
    Hello, where can I read more about roadmap item "Pluggable backends like native or SQL". Any dates for it ?
    Holger Brandl
    Uups, gitter stopped sending me notifications somehow.
    @chudo19 There are no specific dates yet. It's just a vague idea so far.
    Holger Brandl
    Please note the e. It's a well known phenomenon in linguistics that adding or skipping letters in words can alter their meaning.

    Hello :)
    I'm not a Kotlin expert. I started using krangl 2 days ago after using pandas...

    So far I was able to replace Python code using Kotlin and krangl but now I'm not sure how can I filter data only e.g. with Id existing in specified set (isin function in pandas).
    I found a solution on stackoverflow:

    .filter{it["id"].isMatching<String>(it as String in setOf("1","2"))}

    but there is an error because it is a context not a value

    Thomas Pryce Jones
    Hello, what if we do a fork for Android compatibility?
    Holger Brandl
    Sure thing, thats the beauty of opensource. 😊