sohailshk opened a new issue, #41305:
URL: https://github.com/apache/beam/issues/41305
### What happened?
The proxy of `DeferredGroupBy.skew()` is computed by pandas on an empty
frame, where the integer or bool dtype of the input is kept, while the real
result for such columns is float64. Converting the result with `to_pcollection`
infers an integer schema, and encoding the rows then fails. Example (default
runner):
import apache_beam as beam
from apache_beam.dataframe.convert import to_dataframe, to_pcollection
rows = [beam.Row(a=i + 1, c=c) for i, c in enumerate('xyxyxzzx')]
with beam.Pipeline() as p:
df = to_dataframe(p | beam.Create(rows))
to_pcollection(df.groupby('c').skew(), include_indexes=True) |
beam.Reshuffle()
With Beam 2.77.0 from PyPI this fails with `ValueError: Attempted to encode
null for non-nullable field "a"`, and with master from source with `TypeError:
unsupported operand type(s) for &: 'float' and 'int'`. The proxy dtype of `a`
is int64, the real dtype float64 (NaN for the groups with fewer than 3 rows).
`SeriesGroupBy.skew()` has the same wrong proxy dtype. Expected: a float64
proxy for integer and bool columns, as for `groupby().mean()`. I plan to cast
those proxy columns to float64.
Version: 2.77.0, and master at 2a7c56bacb1.
### Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
### Issue Components
- [x] Component: Python SDK
- [ ] Component: Java SDK
- [ ] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [ ] Component: Beam YAML
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Infrastructure
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Prism Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]