polars icon indicating copy to clipboard operation
polars copied to clipboard

fold: expand datatypes as arguments

Open ritchie46 opened this issue 3 years ago • 0 comments

df = pl.DataFrame({
    "cars": ["audi", "vw", None],
    "animals": ["cat", "dog", None],
})
df.select([
    pl.all(pl.col(pl.Utf8)
])
---------------------------------------------------------------------------
DuplicateError                            Traceback (most recent call last)
Input In [17], in <cell line: 5>()
      1 df = pl.DataFrame({
      2     "cars": ["audi", "vw", None],
      3     "animals": ["cat", "dog", None],
      4 })
----> 5 df.select([
      6     pl.all(pl.col(pl.Utf8).is_null())
      7 ])

File ~/code/polars/py-polars/polars/internals/frame.py:5170, in DataFrame.select(self, exprs)
   5128 def select(
   5129     self: DF,
   5130     exprs: (
   (...)
   5135     ),
   5136 ) -> DF:
   5137     """
   5138     Select columns from this DataFrame.
   5139 
   (...)
   5167 
   5168     """
   5169     return (
-> 5170         self.lazy()
   5171         .select(exprs)  # type: ignore[arg-type]
   5172         .collect(no_optimization=True, string_cache=False)
   5173     )

File ~/code/polars/py-polars/polars/internals/lazy_frame.py:644, in LazyFrame.collect(self, type_coercion, predicate_pushdown, projection_pushdown, simplify_expression, string_cache, no_optimization, slice_pushdown)
    634     projection_pushdown = False
    636 ldf = self._ldf.optimization_toggle(
    637     type_coercion,
    638     predicate_pushdown,
   (...)
    642     slice_pushdown,
    643 )
--> 644 return self._dataframe_class._from_pydf(ldf.collect())

DuplicateError: Column with name: 'all' has more than one occurrences


ritchie46 avatar Jul 31 '22 16:07 ritchie46