Comments (13)
It's pity that you are so lazy and not familiar with your own cookbook
It is not written by him. In any case it's a community efford. I would appreciate if you would stay respectful to our contributors they do this in their free time.
from polars-book.
I could probably check this out soon if no one else has gotten to it.
from polars-book.
hey @yanyu2015! Could you point me in the right direction for this?
- I don't want to have to search around for the first example, so a link would be perfect.
- Not sure I see what you'd like to change for the second snippet.
- Manual Sum error should be fixed in #147
from polars-book.
1 It's pity that you are not familiar with your own cookbook. the link.
2 please give which specify data you use, it's ambiguous, are you sure that code can work well?
from polars-book.
I am sorry for my rude words. But I also do this in my free time, polars is great and I want to contribute to it.
I writed this issue TWICE before 14 days ago, but until today no one has fixed it or even knows where it is, which makes me feel uncomfortable. Cookbook is the most authoritative source for every beginner, and I think we should take it seriously. When I recommended polars to my friends, they felt that the cookbook was not friendly enough, which made me feel embarrassed.
from polars-book.
Then let's improve it!
from polars-book.
1 It's pity that you are not familiar with your own cookbook. the link.
Done!
2 please give which specify data you use, it's ambiguous, are you sure that code can work well?
Hmm.. curious. Maybe I'm looking at the wrong spot here as well, so correct me if I'm wrong, but there's a link to US Congress dataset above the snippet. I see that it's not a link in your screenshot though.
from polars-book.
Noticing there might be similar feedback from #120.
Getting the US congress dataset code sample on GroupBy page (3.3) is very unclear about how to replicate ("from .dataset import dataset" doesn't work and is rather unclear how to execute other than that snippet)
Edit: rereading that it seems more like a user error.
from polars-book.
you are nice.
To the 2 point, the reason is the from .dataset import dataset
seems not work. and US Congress dataset is right, but there are so many datasets so taht people may not know which one is the right dataset the cookbook used. I try legislators-current
and other dataset. If someone cannot replicate the result as the page presented they may feel confused.
from polars-book.
Here's the dataset
that's imported
polars-book/user_guide/src/examples/groupby_dsl/dataset.py
Lines 1 to 13 in b6e0383
from polars-book.
I try the code again.
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_35972/3485124543.py in <module>
1 import polars as pl
2
----> 3 from .dataset import dataset
4
5 q = (
ImportError: attempted relative import with no known parent package
I see you have trid to fix it in #120
from polars-book.
Try
import polars as pl
url = "https://theunitedstates.io/congress-legislators/legislators-historical.csv"
dtypes = {
"first_name": pl.Categorical,
"gender": pl.Categorical,
"type": pl.Categorical,
"state": pl.Categorical,
"party": pl.Categorical,
}
dataset = pl.read_csv(url, dtype=dtypes).with_column(
pl.col("birthday").str.strptime(pl.Date, strict=False)
)
q = (
dataset.lazy()
.groupby("first_name")
.agg(
[
pl.count(),
pl.col("gender").list(),
pl.first("last_name"),
]
)
.sort("count", reverse=True)
.limit(5)
)
df = q.collect()
from polars-book.
ok, it works well. Let's close this issue.
from polars-book.
Related Issues (20)
- Dark mode
- Make the difference between table operations and column operations more clear HOT 3
- SQL Documentation
- ENH: Detect user preference for dark/light mode using `window.matchMedia('(prefers-color-scheme: dark)')`
- Return of the multi-processing page HOT 2
- Struct Data Type HOT 7
- List Data Type HOT 6
- Add Python lambda example HOT 2
- Programmatic access of the Polars guide is not allowed HOT 2
- Example in section "Type checking in the lazy API" does not raise an error HOT 3
- Make the header in the book pointing to compiled page
- Update documentation about Datetime types HOT 2
- Broken link to API documentation
- Lacking Rust Examples
- DOC: polars cheat sheet HOT 2
- Wrong output dataframe? HOT 7
- Add open source license
- Rust examples: `group_by` should be `groupby` ? HOT 5
- The contents of this repository are being moved
- Redirect to new user guide
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-book.