a pythonic query language
Sign in or create a new account.
Activated, AssistedTackles, AuctionValue, AuctionValuePPR, BlockedKickReturnTouchdowns, BlockedKickReturnYards, BlockedKicks, DefensiveSnapsPlayed, DefensiveTeamSnaps, DefensiveTouchdowns, DraftKingsSalary, ExtraPointsAttempted, ExtraPointsHadBlocked, ExtraPointsMade, FanDuelSalary, FantasyDataSalary, FantasyPoints, FantasyPointsDraftKings, FantasyPointsFanDuel, FantasyPointsYahoo, FantasyPosition, FieldGoalPercentage, FieldGoalReturnTouchdowns, FieldGoalReturnYards, FieldGoalsAttempted, FieldGoalsHadBlocked, FieldGoalsLongestMade, FieldGoalsMade, FieldGoalsMade0to19, FieldGoalsMade20to29, FieldGoalsMade30to39, FieldGoalsMade40to49, FieldGoalsMade50Plus, FumbleReturnTouchdowns, FumbleReturnYards, Fumbles, FumblesForced, FumblesLost, FumblesOutOfBounds, FumblesOwnRecoveries, FumblesRecovered, GameDate, HomeOrAway, Humidity, InterceptionReturnTouchdowns, InterceptionReturnYards, Interceptions, IsGameOver, KickReturnFairCatches, KickReturnLong, KickReturnTouchdowns, KickReturnYards, KickReturnYardsPerAttempt, KickReturns, MiscAssistedTackles, MiscFumblesForced, MiscFumblesRecovered, MiscSoloTackles, Name, Number, OffensiveSnapsPlayed, OffensiveTeamSnaps, OffensiveTouchdowns, Opponent, PassesDefended, PassingAttempts, PassingCompletionPercentage, PassingCompletions, PassingInterceptions, PassingLong, PassingRating, PassingSackYards, PassingSacks, PassingTouchdowns, PassingYards, PassingYardsPerAttempt, PassingYardsPerCompletion, Played, PlayerGameID, PlayerID, PlayerSeasonID, PlayingSurface, Position, PositionCategory, PuntAverage, PuntInside20, PuntLong, PuntNetAverage, PuntNetYards, PuntReturnFairCatches, PuntReturnLong, PuntReturnTouchdowns, PuntReturnYards, PuntReturnYardsPerAttempt, PuntReturns, PuntTouchbacks, PuntYards, Punts, PuntsHadBlocked, QuarterbackHits, ReceivingLong, ReceivingTargets, ReceivingTouchdowns, ReceivingYards, ReceivingYardsPerReception, ReceivingYardsPerTarget, ReceptionPercentage, Receptions, RushingAttempts, RushingLong, RushingTouchdowns, RushingYards, RushingYardsPerAttempt, SackYards, Sacks, Safeties, SafetiesAllowed, Season, SeasonType, ShortName, SoloTackles, SpecialTeamsAssistedTackles, SpecialTeamsFumblesForced, SpecialTeamsFumblesRecovered, SpecialTeamsSnapsPlayed, SpecialTeamsSoloTackles, SpecialTeamsTeamSnaps, SpecialTeamsTouchdowns, Stadium, Started, Tackles, TacklesForLoss, Team, Temperature, Touchdowns, TwoPointConversionPasses, TwoPointConversionReceptions, TwoPointConversionReturns, TwoPointConversionRuns, VictivSalary, Week, WindSpeed, YahooSalary
Both fields and conditions are made up of terms.
A term is a valid Python expression in a name space made up of: database parameters; any imported python modules; PyQL Aggregators such as Average (A), Sum (S), and Replace (R); and other domain specific terms.
|About the FantasyData Database||Sample Queries|
The Raw Data
This database is built from the FantasyData csv file called PlayerGame.2015.csv. The player images were downloaded from FantasyData using the urls given in the file called Player.2015.csv. These are available to use in scatter plots by specifing PlayerID as the third request parameter.
Like this for superbowl 50 rushers: RushingAttempts,RushingYards,PlayerID@SeasonType =3 and Week=4.
Join in Player Information with P.
One of the joys of domain specific query languages is that you can join in data as you like. And here I like P.Weight All of the headers of the FantasyData file called Player.2015.csv are available with this P. format. Here are a few important join fields
Team, Number, FantasyPosition, HeightFeet, HeightInches, Weight, BirthDate, College, Experience, DepthOrder, CollegeDraftYear, CollegeDraftRound, CollegeDraftPick, IsUndraftedFreeAgentitionRank
For example to see Height v Weight broken down by FantasyPosition use the PyQL:
Agile Access to Database Parameters
The CamelCaseFormatting of the database parameters is logical, readable, and verbose. With domain specific query languages you make the rules for parameter reference. And here I like:
Access parameters by their capitalized letters and fill in lower case letters to remove any ambiguity.
For example, to see a scatter plot of RushingYardsPerAttempt vs RushingAttempts (using player images as icons),
use the PyQL:
A simple plot to start with compares fantasy point parameters: |
To see a plotly box plot of fantasy points for the top 30 QBs use the PyQL:
To see the week, fantasy salary, and fantasy point for Matt Ryan during the regular season use the PyQL:
To see how fantasy points tracks with fantasy salary use the PyQL:
To see how fantasy points tracks with fantasy salary for Running Backs on each team, use the PyQL:
For a scatter plot of total punt yards v number of punts inside the 20 use the PyQL:
For a scatter plot of total passing yards v total rushing yards for playoff teams use the PyQL
To see Denver's passing yards for each week and passer use the PyQL
I find this very simple one very interesting: