astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v1.1.1 »
- ASCII Tables (`astropy.io.ascii`) »
- convert_numpy

# convert_numpy

`astropy.io.ascii.``convert_numpy`(numpy_type)

  Return a tuple containing a function which converts a list into a numpy array and the type produced by the converter function.

  Parameters:

  numpy_type : numpy data-type

  > The numpy type required of an array returned by `converter`. Must be a valid numpy type, e.g. numpy.int, numpy.uint, numpy.int8, numpy.int64, numpy.float, numpy.float64, numpy.str.

  Returns:

  (converter, converter_type) : (function, generic data-type)

  > `converter` is a function which accepts a list and converts it to a numpy array of type `numpy_type`. `converter_type` tracks the generic data type produced by the converter function.

  Raises:

  ValueError

  > Raised by `converter` if the list elements could not be converted to the required type.