Comments (3)
Looks like that method already works, so let's document it and close this out!
In [8]: from ibis.interactive import *
In [9]: t = ex.penguins.fetch()
In [10]: expr = t.select("species", "island").value_counts().order_by(s.across(s.contains("count"), _.desc()))
In [11]: ibis.to_sql(expr)
Out[11]:
SELECT
*
FROM (
SELECT
"t1"."species",
"t1"."island",
COUNT(*) AS "species_island_count"
FROM (
SELECT
"t0"."species",
"t0"."island"
FROM "penguins" AS "t0"
) AS "t1"
GROUP BY
1,
2
) AS "t2"
ORDER BY
"t2"."species_island_count" DESC
In [12]: expr
Out[12]:
┏━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓
┃ species ┃ island ┃ species_island_count ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩
│ string │ string │ int64 │
├───────────┼───────────┼──────────────────────┤
│ Gentoo │ Biscoe │ 124 │
│ Chinstrap │ Dream │ 68 │
│ Adelie │ Dream │ 56 │
│ Adelie │ Torgersen │ 52 │
│ Adelie │ Biscoe │ 44 │
└───────────┴───────────┴──────────────────────┘
from ibis.
@lostmygithubaccount Is there an equivalent dplyr syntax here? Would be good to mirror that as much as possible if it exists.
from ibis.
Looks like in dplyr you can use across
:
And for desc
as well:
If that doesn't work we should implement it that way.
Reference: https://dplyr.tidyverse.org/reference/arrange.html
from ibis.
Related Issues (20)
- Impala backend how to drop memtable tmp table after `insert(data)`
- feat: `ibis.select()` HOT 13
- bug: Snowflake connection hangs indefinitely using "authenticator="externalbrowser" HOT 1
- feat: Unsuccessfully tried to mimic "unbounded" column behavior, as `pyspark` API allows HOT 6
- feat: expose `highest_precedence(*dtypes)` HOT 2
- Omission of data frame origins of S and R HOT 4
- bug: cannot do table.mutate(column_name="some_string") HOT 1
- perf(pandas): "pandas via ibis" is 4 times slower than running pandas directly HOT 5
- `Backend.sql()` throws error if db user has only read permissions HOT 1
- feat(selectors): parse Python types in `s.of_type`
- feat: support read_parquet for ms sql backend HOT 1
- refactor: remove `ImpalaTable` subclass HOT 1
- Support for sharded BigQuery tables HOT 1
- bug(oracle): Ibis assumes that a boolean type exists in the version of oracle being used
- feat: allow specify the length of string column HOT 3
- bug: data type inference in timestamp .delta expression
- bug: HOT 3
- Inserting permuted named columns caused data to get saved in the wrong columns HOT 1
- bug: cannot use window expression in filter HOT 2
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 ibis.