ARahimiQuant/finpy-tse

error when using Get_RI_History function

Closed this issue · 2 comments

error occurs when using Get_RI_History function however other function works properly

fpy.Get_RI_History(
stock='خودرو',
start_date='1400-01-01',
end_date='1401-01-01',
ignore_date=False,
show_weekday=False,
double_date=False,
alt=False)

---------------------------------------------------------------------------

AttributeError Traceback (most recent call last)
Cell In[5], line 1
----> 1 fpy.Get_RI_History(
2 stock='داوه',
3 start_date='1400-01-01',
4 end_date='1401-01-01',
5 ignore_date=False,
6 show_weekday=False,
7 double_date=False,
8 alt=False)

File ~/.conda/envs/tf/lib/python3.9/site-packages/finpy_tse/init.py:659, in Get_RI_History(stock, start_date, end_date, ignore_date, show_weekday, double_date, alt)
657 df_RI_tab = df_RI_tab.reset_index()
658 # determining week days:
--> 659 df_RI_tab['Weekday']=df_RI_tab['Date'].dt.weekday
660 df_RI_tab['Weekday'] = df_RI_tab['Weekday'].apply(lambda x: calendar.day_name[x])
661 df_RI_tab['J-Date']=df_RI_tab['Date'].apply(lambda x: str(jdatetime.date.fromgregorian(date=x.date())))

File ~/.conda/envs/tf/lib/python3.9/site-packages/pandas/core/generic.py:6299, in NDFrame.getattr(self, name)
6292 if (
6293 name not in self._internal_names_set
6294 and name not in self._metadata
6295 and name not in self._accessors
6296 and self._info_axis._can_hold_identifiers_and_holds_name(name)
...
640 elif isinstance(data.dtype, PeriodDtype):
641 return PeriodProperties(data, orig)
--> 643 raise AttributeError("Can only use .dt accessor with datetimelike values")

AttributeError: Can only use .dt accessor with datetimelike values

Use "get_ri_history"
rather than "Get_RI_History".
image

Use "get_ri_history" rather than "Get_RI_History". image

Thanks Morteza!