Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip empty dataframes when creating addplots #103

Open
fxhuhn opened this issue Apr 21, 2020 · 0 comments
Open

Skip empty dataframes when creating addplots #103

fxhuhn opened this issue Apr 21, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@fxhuhn
Copy link
Contributor

fxhuhn commented Apr 21, 2020

I add signals to my diagram using make_addplot. But if there are no signals in the selected time period, I get an error.

I have solved it for me as follows:

            if stock[stock['Signal'].notnull()].shape[0] == 0:
                print ("- no Signal")
            else:
                signal_short = mpf.make_addplot(stock['Signal'] * 0.93,
                                                scatter=True,
                                                markersize=150,
                                                marker='v',
                                                color='red'
                                                )
                add_plots.append(signal_short)

Would it not be an option to integrate this directly into the function and, if necessary, only issue a warning?

    if data.notnull()].shape[0] == 0:
        raise Warning("Empty Dataframe!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant