Hi
I'm trying to plot some data relative to the start-time of the data. Therefore I substract the first timestamp form the DataFrame index and set the result as the new index.
The DataFrame with the new index looks fine, but when I try to plot the data or just save it to a file I get an error. Do I have to create the new DataFrame in a different way,
or is this a bug?
Pandas version is 0.16.1, Python is 3.4.1
Thank you for your answers!
A simple example:
Python 3.4.1 (default, Nov 3 2014, 14:38:10)
Type "copyright", "credits" or "license" for more information.
IPython 3.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import pandas as pd
In [2]: df = pd.DataFrame({'a': [1,2,3,4], 'b': [1,2,3,4]}, index = pd.date_range('20150606', periods=4, freq='H'))
In [3]: df
Out[3]:
a b
2015-06-06 00:00:00 1 1
2015-06-06 01:00:00 2 2
2015-06-06 02:00:00 3 3
2015-06-06 03:00:00 4 4
In [4]: df.index = df.index - df.index[0]
In [5]: df
Out[5]:
a b
00:00:00 1 1
01:00:00 2 2
02:00:00 3 3
03:00:00 4 4
In [6]: df.plot()
---------------------------------------------------------------------------
MemoryError Traceback (most recent call last)
....
MemoryError:
In [7]: df.to_csv('out.txt')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
.....
TypeError: Argument 'data_index' has incorrect type (expected numpy.ndarray, got list)
In [8]: pd.__version__
Out[8]: '0.16.1'