2

Python - Pandas: AttributeError: 'numpy.ndarray' object has no attribute 'start'

Code that generates the error:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from datetime import time

data = pd.read_csv('/temp/zondata/pvlog.csv', delimiter=';', parse_dates=True, index_col=1)
Gewenst = data['T_Sanyo_Open']

Gives no errors, and gives a result like the table at the bottom of this question:

Gewenst['2010']

or

Gewenst['2010-09']

Gives me previously described error when I want a specific bounded range of data:

Gewenst['2010-9':'2010-10']

I found a solution when I add this rule of code:

Gewenst = Gewenst.resample('1Min', fill_method='ffill') 

But I don't want to resample the data.

table:

2010-08-31 12:36:53    30.37
2010-08-31 12:45:08    28.03
2010-08-31 12:55:09    25.16
2010-08-31 13:00:09    23.28
2010-08-31 13:05:09    22.37
2010-08-31 13:10:09    21.84
2010-08-31 13:15:08    22.19
2010-08-31 13:20:09    22.41
2010-08-31 13:25:09    23.16
2010-08-31 13:35:09    23.59
2010-08-31 13:40:09    26.75
2010-08-31 13:45:09    29.47
2010-08-31 13:50:10    33.13
2010-08-31 13:55:08    35.91
2010-08-31 14:00:08    37.78
...
2013-06-07 01:35:10    40.00
2013-06-07 01:40:10    40.00
2013-06-07 01:45:10    39.50
2013-06-07 01:50:12    39.75
2013-06-07 01:55:10    39.25
2013-06-07 02:00:10    39.50
2013-06-07 02:05:11    39.25
2013-06-07 02:10:11    39.25
2013-06-07 02:15:10    38.75
2013-06-07 02:20:11    38.75
2013-06-07 02:25:11    38.75
2013-06-07 02:30:10    39.25
2013-06-07 02:40:10    39.25
2013-06-07 02:45:10    39.00
2013-06-07 02:50:10    39.25

Does anyone have solution, or is this a bug in Pandas?

1 Answer 1

2

It looks like it's important to include the 0:

In [11]: df1['2010-7':'2010-10']
Out[11]:
Empty DataFrame
Columns: [value]
Index: []

In [12]: df1['2010-07':'2010-10']
Out[12]:
                     value
date
2010-08-31 12:36:53  30.37
2010-08-31 12:45:08  28.03
2010-08-31 12:55:09  25.16
2010-08-31 13:00:09  23.28
...

Could be worth filing an issue...

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.