In order to account for the units, I think you need to do something like:
def get_unixtime(dt64):
return dt64.astype('datetime64[s]').astype('int')
Note that this converts to ‘seconds’ (the [s]
) prior to converting to integers. This works on NumPy 1.12.1.
More Related Contents:
- Need a python module for numerical and scientific computing other than NumPy and SciPy
- How do you fix “runtimeError: package fails to pass a sanity check” for numpy and pandas?
- How do I read CSV data into a record array in NumPy?
- How do I build a numpy array from a generator?
- Difference between numpy dot() and Python 3.5+ matrix multiplication @
- Conditionally fill column values based on another columns value in pandas
- How to convert an array of strings to an array of floats in numpy?
- How to extract an arbitrary line of values from a numpy array?
- How to find the average colour of an image in Python with OpenCV?
- How do I convert a PIL Image into a NumPy array?
- How do I remove NaN values from a NumPy array?
- matplotlib – extracting data from contour lines
- Using numpy.genfromtxt to read a csv file with strings containing commas
- Matplotlib Plot Lines with Colors Through Colormap
- Iterating over arbitrary dimension of numpy.array
- Remove duplicate rows of a numpy array [duplicate]
- Create new dataframe in pandas with dynamic names also add new column
- How can I efficiently process a numpy array in blocks similar to Matlab’s blkproc (blockproc) function
- How to convert a column or row matrix to a diagonal matrix in Python?
- Convert NumPy array to 0 or 1 based on threshold
- Using numpy ‘module’ object has no attribute ‘array’ [duplicate]
- SQL join or R’s merge() function in NumPy?
- Getting days since last occurence in Pandas DataFrame?
- multi core processing in for loop using numpy
- How to have logarithmic bins in a Python histogram
- Python Pandas: remove entries based on the number of occurrences
- Fast Way to slice image into overlapping patches and merge patches to image
- How to smooth a curve for a dataset
- Numpy.Array in Python list?
- Numpy equivalent of itertools.product [duplicate]