Comments (2)
if there is no express in group by column, it's ok
>>> df = pl.DataFrame(
... {
... "A": [1, 1, 3, 3, 5],
... "fruits": ["banana", "banana", "apple", "apple", "banana"],
... "B": [5, 4, 3, 2, 1],
... "cars": ["beetle", "audi", "beetle", "beetle", "beetle"],
... }
... )
>>>
>>> sql = pl.SQLContext(t=df)
>>> sql.execute("select A, count(*)from t group by A", eager=True)
shape: (3, 2)
┌─────┬─────┐
│ A ┆ len │
│ --- ┆ --- │
│ i64 ┆ u32 │
╞═════╪═════╡
│ 1 ┆ 2 │
│ 3 ┆ 2 │
│ 5 ┆ 1 │
└─────┴─────┘
>>> sql.execute("select A as o, count(*)from t group by A", eager=True)
shape: (3, 2)
┌─────┬─────┐
│ o ┆ len │
│ --- ┆ --- │
│ i64 ┆ u32 │
╞═════╪═════╡
│ 5 ┆ 1 │
│ 1 ┆ 2 │
│ 3 ┆ 2 │
└─────┴─────┘
>>> sql.execute("select A%3 as o, count(*)from t group by A%3", eager=True)
shape: (3, 2)
┌───────────┬─────┐
│ o ┆ len │
│ --- ┆ --- │
│ list[i64] ┆ u32 │
╞═══════════╪═════╡
│ [0, 0] ┆ 2 │
│ [2] ┆ 1 │
│ [1, 1] ┆ 2 │
└───────────┴─────┘
>>> sql.execute("select A%3 , count(*)from t group by A%3", eager=True)
shape: (3, 2)
┌─────┬─────┐
│ A ┆ len │
│ --- ┆ --- │
│ i64 ┆ u32 │
╞═════╪═════╡
│ 1 ┆ 2 │
│ 2 ┆ 1 │
│ 0 ┆ 2 │
└─────┴─────┘
from polars.
0.20.15 has the same issue
from polars.
Related Issues (20)
- `Series.unique_counts` not supported for dtype `bool` HOT 1
- `floor`/`ceil` for integers
- `expr.to_field` returns wrong datatype for bitwise and/or HOT 2
- Loading an excel file with `read_excel(engine="calamine")` fails when a float column is all NaN's HOT 6
- Documentation for `all/any_horizontal` mismatched with implementation
- `all_horizontal` on wide dataframes crashes with SIGSEV on latest polars HOT 3
- It would be nice to be able to aggregate not just by rolling windows in time but by boolean expression bounded windows HOT 2
- Some struct functions do not work on `.list.to_struct` HOT 3
- write_delta claims Categoricals aren't supported, but they are
- Add contingency table/ frequency table functionality in .pivot method HOT 7
- `.struct.field('*')` StructFieldNotFoundError HOT 2
- `.struct.field('*')` PanicException: no `rename_alias` at this point
- Panic in calling to_numpy on a concatted DataFrame HOT 3
- scan_parquet collect streaming not streaming even though explain indicates streaming HOT 6
- wrong documentation in DataFrame.update HOT 1
- ComputeError: unable to parse Hive partition value: "TRUE" HOT 3
- `min` fails on `duration` types HOT 3
- Github release for rust-polars 0.40.0 HOT 1
- Getting panic when calling `LazyFrame.group_by().map_groups` and intermitten panic when calling `LazyFrame.columns` HOT 8
- GitHub release seems created with wrong commit? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from polars.