Coder Social home page Coder Social logo

Comments (3)

PiRK avatar PiRK commented on July 16, 2024

If we want to be conservative we could try to detect the data type for each column when the user doesn't specify which format he wants. My suggestion would be:

  • %d for integers
  • %.7g for float32
  • %.18e for float64

If the user specifies a format we should assume he knows what he is doing and not try to check types.

We can do something similar to numpy.savetxt (http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.savetxt.html): 

  • fmt parameter:

single format (%10.5f), a sequence of formats, or a multi-format string, e.g. ‘Iteration %d – %10.5f’, in which case delimiter is ignored.

Except we could set fmt=None as default and assign our default format depending on the type.

Should we handle complex values ?

But again, I would not have any moral problem if we just assumed that a vast majority users who don't bother defining a custom format would be happy with %.7g for all values, because it looks nicer and uses less disk space. We would just need to specify in the documentation that the default behavior is not safe for extremely large integers and very precise floats.

from silx.

t20100 avatar t20100 commented on July 16, 2024

Yes, that's why I asked the question.
Do we want a conservative default behavior or a simple one?

from silx.

vasole avatar vasole commented on July 16, 2024

Simple one. If it turns out to be not enough we change. A bit of Extreme Programming should make no harm. If we start from "Cogito ergo sum" we are not going to get very far.

from silx.

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.