matplotlib / matplotlib/mplfinance

Skip empty dataframes when creating addplots

Abierto
#103 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

enhancement
Lenguaje dominante
Python
Estrellas
4.4k
Forks
678
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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!")
```

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
matplotlib, python
Área
data-visualization
Tipo de issue
Nueva funcionalidad
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.