Proposal to conditionally include numpy data types as known numerics.

#102 Declined
  1. Joseph Fox-Rabinovitz

Proposal to conditionally include numpy data types as known numerics.

Comments (5)

  1. CharlieC

    We do want to add support for Numpy but it would have to be a bit more extensive than this. At the very least the serialisation code will probably also need looking at and tests will be required.

  2. Joseph Fox-Rabinovitz author

    I agree that a pull request was probably not the best way to make this proposal. Could you point me to the place where serialization is done? I can try to add the required functionality there and write some tests. Does the change I made so far look sensible? As I said in my comment to Issue #49, it might be a good idea to have a public to add new types dynamically at some point, but NUMERIC_TYPES would probably have to be mutable for that.

    1. CharlieC

      safe_string does pretty much everything. It's a pain because the XML libraries won't serialise numbers automatically. And it's worth noting that precision is limited in Excel.

      Support for date and time types should also be added and I suspect this will be harder to do: they have to be converted to Excel's serials.

      I'd handle Numpy as a soft dependency just as we do with LXML so that we have a constant to check whether it's around. This would, for example, make it possible to convert to Numpy when reading files. This makes tests easier as well.

      Currently, I don't see the need for a type registry as we're not really providing a serialisation library and read support is particularly convoluted, so that there is no easy API as there is say for JSON. Apart from that: constants should never be mutable.

  3. Joseph Fox-Rabinovitz author

    Not in this form. I've been to busy to revisit the problem until recently. Since then I've learned a couple of things about numpy that would make this approach unnecessarily complicated. I will close the PR and open a proper one in a bit.