trendet icon indicating copy to clipboard operation
trendet copied to clipboard

no attribute 'identify_all_trends' (most likely due to a circular import)

Open maciekinlondon opened this issue 3 years ago • 3 comments

Hi, I've tried to run trendet script but it gives me an attribute error: AttributeError: partially initialized module 'trendet' has no attribute 'identify_all_trends' (most likely due to a circular import) Do you have any idea what that could be?

maciekinlondon avatar Nov 05 '20 22:11 maciekinlondon

I'm getting similar error

AttributeError: partially initialized module 'trendet' has no attribute 'identify_df_trends' (most likely due to a circular import)

bagcivan avatar Apr 19 '21 13:04 bagcivan

Hi both @maciekinlondon and @bagcivan, thanks for reporting it! I'll try to solve this later today hopefully and then release a new version with the updated code! :fire:

alvarobartt avatar Apr 20 '21 08:04 alvarobartt

Hi alvarobartt, Im getting the same error. Strangly when I first installed the library it worked fine, without changing anything I returned to the code last night 3/10/2021 and it gave this error. Ive tried updating the library without success.

I was running the sample code listed below

Any news on a fix ? Thanks

import trendet

import matplotlib.pyplot as plt import seaborn as sns

sns.set(style='darkgrid')

df = trendet.identify_all_trends(stock='BBVA', country='Spain', from_date='01/01/2018', to_date='01/01/2019', window_size=5)

df.reset_index(inplace=True)

with plt.style.context('paper'): plt.figure(figsize=(20, 10))

ax = sns.lineplot(x=df['Date'], y=df['Close'])

labels = df['Up Trend'].dropna().unique().tolist()

for label in labels:
    sns.lineplot(x=df[df['Up Trend'] == label]['Date'],
                 y=df[df['Up Trend'] == label]['Close'],
                 color='green')

    ax.axvspan(df[df['Up Trend'] == label]['Date'].iloc[0],
               df[df['Up Trend'] == label]['Date'].iloc[-1],
               alpha=0.2,
               color='green')

labels = df['Down Trend'].dropna().unique().tolist()

for label in labels:
    sns.lineplot(x=df[df['Down Trend'] == label]['Date'],
                 y=df[df['Down Trend'] == label]['Close'],
                 color='red')

    ax.axvspan(df[df['Down Trend'] == label]['Date'].iloc[0],
               df[df['Down Trend'] == label]['Date'].iloc[-1],
               alpha=0.2,
               color='red')

plt.show()

trev1966 avatar Oct 04 '21 07:10 trev1966