Hi, I am a beginner of python programming and I got a problem on results table.
I will truly appreciate if you can help me.
The following is my code:
event= es.Single.constant_mean( security_ticker= 'aapl', event_date= np.datetime64('2020-01-16'), event_window= (-2,+10), estimation_size= 30, buffer_size= 0)
event.results(decimals=[3,5,3,5,2,2])
TypeError Traceback (most recent call last)
in
5 estimation_size= 30,
6 buffer_size= 0)
----> 7 event.results(decimals=[3,5,3,5,2,2])
D:\Anaconda3\lib\site-packages\eventstudy\single.py in results(self, asterisks, decimals)
194 asterisks_dict=asterisks_dict,
195 decimals=decimals,
--> 196 index_start=self.event_window[0],
197 )
198
D:\Anaconda3\lib\site-packages\eventstudy\utils.py in to_table(columns, asterisks_dict, decimals, index_start)
28 )
29
---> 30 df = pd.DataFrame.from_dict(columns)
31 df.index += index_start
32 return df
D:\Anaconda3\lib\site-packages\pandas\core\frame.py in from_dict(cls, data, orient, dtype, columns)
1136 raise ValueError('only recognize index or columns for orient')
1137
-> 1138 return cls(data, index=index, columns=columns, dtype=dtype)
1139
1140 def to_numpy(self, dtype=None, copy=False):
D:\Anaconda3\lib\site-packages\pandas\core\frame.py in init(self, data, index, columns, dtype, copy)
390 dtype=dtype, copy=copy)
391 elif isinstance(data, dict):
--> 392 mgr = init_dict(data, index, columns, dtype=dtype)
393 elif isinstance(data, ma.MaskedArray):
394 import numpy.ma.mrecords as mrecords
D:\Anaconda3\lib\site-packages\pandas\core\internals\construction.py in init_dict(data, index, columns, dtype)
210 arrays = [data[k] for k in keys]
211
--> 212 return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
213
214
D:\Anaconda3\lib\site-packages\pandas\core\internals\construction.py in arrays_to_mgr(arrays, arr_names, index, columns, dtype)
49 # figure out the index, if necessary
50 if index is None:
---> 51 index = extract_index(arrays)
52 else:
53 index = ensure_index(index)
D:\Anaconda3\lib\site-packages\pandas\core\internals\construction.py in extract_index(data)
303 elif is_list_like(val) and getattr(val, 'ndim', 1) == 1:
304 have_raw_arrays = True
--> 305 raw_lengths.append(len(val))
306
307 if not indexes and not raw_lengths:
TypeError: object of type 'map' has no len()