Chapter 11 00_custom_bundle

Hi,
I’m stucked at runnning ‘stook_preprocessing.py’.

>     for sid, symbol in symbols.set_index('sid').symbol.items():
>             p = prices.loc[symbol]
>             p.to_hdf('stooq.h5', 'jp/{}'.format(sid), format='t')

returns error.

AttributeError Traceback (most recent call last)
/var/folders/c0/nmq6y7ps4bzbyh7q4j6lcr3c0000gn/T/ipykernel_190/3366824621.py in
13 end_date = dates.max()
14
—> 15 for sid, symbol in symbols.set_index(‘sid’).symbol.items():
16 p = prices.loc[symbol]
17 p.to_hdf(‘stooq.h5’, ‘jp/{}’.format(sid), format=‘t’)

~/opt/miniconda3/envs/ml4t/lib/python3.8/site-packages/pandas/core/generic.py in getattr(self, name)
5476 ):
5477 return self[name]
→ 5478 return object.getattribute(self, name)
5479
5480 def setattr(self, name: str, value) → None:

AttributeError: ‘DataFrame’ object has no attribute ‘symbol’

I apppreciate if someone help me.

1 Like

I also encountered this problem.

Hey,

Did enyone solve the problem? Having the same issue here. It looks like script is trying to refer to the “symbol” column which does not exist:

image

Hello.
I solved with below.

for sid, symbol in symbols.set_index(‘sid’).ticker.items():

Also, I created a “11-5 or 11-7 program” thread.
I would appreciate it if you could solve the “stooq_preprocessing.py” problem and solve the aforementioned problem together.

1 Like