[Bug]: DataFrame mean() and std() fail on datetime and timedelta columns
Los mantenedores suelen responder en 2 días
Evaluación
Este issue todavía no se ha evaluado.
Descripción
What happened?
mean() and std() on a deferred Series of datetime64 or timedelta64 values fail. pandas returns a Timestamp or a Timedelta:
import pandas as pd
import apache_beam as beam
from apache_beam.dataframe.transforms import DataframeTransform
df = pd.DataFrame({
'wait': pd.to_timedelta([10, 20, 60], unit='s'),
'at': pd.to_datetime(['2024-01-01', '2024-01-02', '2024-01-06']),
})
with beam.Pipeline() as p:
_ = (
p | beam.Create([df])
| DataframeTransform(
lambda df: df.wait.mean(), proxy=df.iloc[:0], yield_elements='pandas')
| beam.Map(print))
# pandas gives Timedelta('0 days 00:00:30'), Beam raises ZeroDivisionError
df['at'].mean() raises TypeError: 'DatetimeArray' with dtype datetime64[ns] does not support reduction 'sum', and std() on either column raises TypeError: unsupported operand type(s) for ** or pow(): 'NaTType' and 'int'. Tz-aware datetimes and DataFrame.mean/std(numeric_only=False) fail the same way. Seen on 2.77.0 and on master.
DeferredSeries.mean divides sum() by count(), which can't work for datetimes and fails on the empty timedelta proxy (Timedelta(0) / 0). std goes through var, which squares the result of pandas std, a Timedelta here. pandas computes both on the values as floats in the unit of the dtype and converts the result back.
Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
Issue Components
- Component: Python SDK
- Lenguaje dominante
- Java
- Estrellas
- 8.7k
- Forks
- 4.8k
- Merge medio
- 3 d 20 h
- PR fusionados (30 d)
- 446
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/beam
-
[Bug]: [Python] BigTableEnrichmentHandler coerces None lookup keys to literal b'None' and formats blank key name on KeyErrorPosiblemente ocupada @shikhabhadoria la tomó hace 10 días. Abiertoio P2 python
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/beam#41346 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Release notes links wrongPosiblemente ocupada @schizophrenicmaniac la tomó hace 24 días. Abiertobug P3
Dificultad 1/5 Menos de una hora Aptitud para principiantes 67/100
apache/beam#41197 · 3 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/beam#39624 · 2 reacciones ·
Los mantenedores suelen responder en 2 días
-
[Bug]: PubsubIO used in batch incorrect batch cutoff sizePosiblemente ocupada @1fanwang la tomó hace 103 días. Abiertobug io P3 pinned pubsub
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/beam#28011 · 4 comentarios ·
Los mantenedores suelen responder en 2 días
-
build P3 sub-task
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
Los mantenedores suelen responder en 2 días
Todos los issues de apache/beam
Issues similares
-
missing Git commit for 10.5-RC2Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
avaje/avaje-metrics#142 · 1 comentario ·
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
RamazanKara/nightjar#299 · 4 comentarios ·
-
Support emergency=access_point (POI type and rendering)Posiblemente ocupada @julenepj la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
osmandapp/OsmAnd#27424 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Link not working in the feedback concerning String.format() in exercise 'Tim from Marketing'Posiblemente ocupada @LaibaMunir016 la tomó hace 1 día. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
exercism/java-analyzer#379 · 1 comentario ·
-
TasksRunnerService.decode() should treat an empty lambdaBody as absentPosiblemente ocupada @gky051224 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
redisson/redisson#7477 · 1 comentario ·
Los mantenedores suelen responder en 2 días