GithubHelp home page GithubHelp logo

Non-string column names about fastparquet HOT 4 CLOSED

dask avatar dask commented on August 18, 2024 1
Non-string column names

from fastparquet.

Comments (4)

poleguy avatar poleguy commented on August 18, 2024 33

I'm leaving this workaround for the next guy:
Try: df.columns = df.columns.astype(str)
https://stackoverflow.com/questions/38577126/convert-column-name-from-int-to-string-in-pandas

from fastparquet.

martindurant avatar martindurant commented on August 18, 2024

Recommendations on what to do about this? If I enforce str(col_name) upon writing, there had better be a check for repeated values, as a set of columns like [0, '0'] is allowed in pandas.
Also, the loaded column labels will always be strings - should they be passed to util.val_to_num? In that case, in column selectors like to_pandas(columns=...), should users refer to the string version or the derived version?

The easy option: require string column names.

from fastparquet.

teh avatar teh commented on August 18, 2024

I can't remember a single case where I was happy with silent coercion but many where I wasn't, so IMHO raising an informative exception ("parquet column names must be strings, but 0, 1, NaN are not strings").

from fastparquet.

mrocklin avatar mrocklin commented on August 18, 2024

Raising on non-strings seems like a fine way to start to me. We can always relax that in the future if we find better solutions.

from fastparquet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.