Comments (3)
Just a few more examples to highlight the unexpected results from this limit function.
No limit produces 8 results:
for p in q.sort('passing_yds').as_plays():
print p
> (NE, OWN 17, Q2, 1 and 10) (9:56) (Shotgun) T.Brady pass short left to S.Vereen for 83 yards, TOUCHDOWN.
> (NE, OWN 37, Q3, 3 and 10) (10:00) (Shotgun) T.Brady pass deep middle to D.Stallworth for 63 yards, TOUCHDOWN. NE 12-Brady 18th career game with 4+ TD passes, passing Johnny Unitas for 4th most all-time.
> (NE, OWN 21, Q1, 1 and 10) (9:32) (No Huddle) T.Brady pass deep left to W.Welker to BAL 20 for 59 yards (B.Pollard).
> (NE, OWN 44, Q2, 3 and 5) (3:17) (Shotgun) T.Brady pass deep left to J.Edelman for 56 yards, TOUCHDOWN.
> (NE, OWN 18, Q4, 1 and 10) (9:18) (No Huddle, Shotgun) T.Brady pass deep right to B.Lloyd to SF 29 for 53 yards (C.Culliver).
> (NE, OPP 46, Q1, 1 and 10) (5:59) (No Huddle, Shotgun) T.Brady pass deep left to W.Welker for 46 yards, TOUCHDOWN.
> (NE, OWN 33, Q1, 2 and 5) (8:57) (Shotgun) T.Brady pass deep right to R.Gronkowski to BUF 26 for 41 yards (J.Rogers). Caught at BUF 32, slanting to sideline.
> (NE, OPP 44, Q3, 2 and 1) (2:09) (No Huddle, Shotgun) T.Brady pass deep right to M.Hoomanawanui to SF 3 for 41 yards (D.Whitner).
[Finished in 0.7s]
limit(1)
produces 0 results.
for p in q.sort('passing_yds').limit(1).as_plays():
print p
[Finished in 0.5s]
limit(10)
produces 1 result:
for p in q.sort('passing_yds').limit(10).as_plays():
print p
> (NE, OWN 17, Q2, 1 and 10) (9:56) (Shotgun) T.Brady pass short left to S.Vereen for 83 yards, TOUCHDOWN.
[Finished in 0.5s]
limit(200)
produces 6 results:
for p in q.sort('passing_yds').limit(200).as_plays():
print p
> (NE, OWN 17, Q2, 1 and 10) (9:56) (Shotgun) T.Brady pass short left to S.Vereen for 83 yards, TOUCHDOWN.
> (NE, OWN 37, Q3, 3 and 10) (10:00) (Shotgun) T.Brady pass deep middle to D.Stallworth for 63 yards, TOUCHDOWN. NE 12-Brady 18th career game with 4+ TD passes, passing Johnny Unitas for 4th most all-time.
> (NE, OWN 21, Q1, 1 and 10) (9:32) (No Huddle) T.Brady pass deep left to W.Welker to BAL 20 for 59 yards (B.Pollard).
> (NE, OWN 44, Q2, 3 and 5) (3:17) (Shotgun) T.Brady pass deep left to J.Edelman for 56 yards, TOUCHDOWN.
> (NE, OWN 18, Q4, 1 and 10) (9:18) (No Huddle, Shotgun) T.Brady pass deep right to B.Lloyd to SF 29 for 53 yards (C.Culliver).
> (NE, OPP 46, Q1, 1 and 10) (5:59) (No Huddle, Shotgun) T.Brady pass deep left to W.Welker for 46 yards, TOUCHDOWN.
[Finished in 0.6s]
from nfldb.
Thanks for the extra examples. This isn't going to be a simple fix, unfortunately. sort
and limit
can be used for performance reasons to make retrieving results quicker. The problem is that its application is across several different SQL queries inside the Query
class, so applying it to each query has to be done carefully in only the correct circumstances. (The complexity results from splitting what seems like a single huge JOIN query into smaller more performant filtering queries. All of the boolean logic expressed with Query
needs to translate seamlessly...)
from nfldb.
I think I fixed this unknowingly. If I had to guess, I think the commit is 51468a6 in nfldb/query.py
.
from nfldb.
Related Issues (20)
- Any active users here? HOT 36
- nfldb-update: command not found HOT 4
- New Season HOT 2
- pip freeze
- Has the NFL ever complained about this project? HOT 2
- pip error
- Game gsis_id = 2017111911 missing in schedule.json (Ochawkeye issue #298)
- Not able to install in Windows HOT 2
- pip installation error HOT 1
- ConfigParser with-update HOT 1
- GSIS ID 2019090808 (CIN @ SEA) stored incomplete JSON to database, unable to replace HOT 4
- Bulk Upload 2017-2019 nfldb-update HOT 4
- Installed and ran nfldb-update. Data Missing for 2017 and 2018 HOT 2
- Expected Points & Win Probability HOT 1
- KeyError Gsis_id = 2019122202
- NFL Update HOT 1
- Anyone have a .sql export with 2019? HOT 1
- XML feeds removed from NFL website? HOT 4
- NFL db update on Anaconda help HOT 1
- Odoo v14 error 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 nfldb.