matplotlib / matplotlib/mplfinance
Skip empty dataframes when creating addplots
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 4.4k
- Fork
- 678
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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!")
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Start at the make_addplot entry point and reproduce the issue with an empty Signal series in the selected time period. Trace how the resulting addplot is handled, then verify that empty data is skipped or reported without raising the current error. Done means the supplied no-signal case completes successfully.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- matplotlib, python
- Ambito
- data-visualization
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100