1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Pandas to polars fails

Discussão em 'Python' iniciado por Stack, Setembro 14, 2024.

  1. Stack

    Stack Membro Participativo

    I am getting data from DBnomics which returns it as pandas df. I prefer polars, and so do pl.from_pandas(df) and that sometimes fails with TypeError: 'float' object cannot be converted to 'PyString'

    here is the code

    import pandas as pd
    from dbnomics import fetch_series
    import polars as pl
    df= fetch_series("WB/WDI/A-NY.GDP.MKTP.CD-RUS")
    df = pl.from_pandas(df)


    I could fix it in this specific case, but is there a way to robustly convert pandas to polars?

    Continue reading...

Compartilhe esta Página