Welcome to FantasyFootball-Crawler's Documentation!

Fantasy football is a game played by many Americans, however most are uneducated when it comes to the various in-depth statistics that are needed to "level up" your team, and potentially win big. Most websites gloss over important statistics, or don't include all of the information needed (think FantasyPros), or perhaps include too much information (think pro-football-reference). I want to build a one-stop-shop for these important statistics. Essentially, this open source library will give you the best players at each position and filter based off of statistics that I deem most important to each position in FF.

The Fantasy-Football Crawler library can now accept specified user inputs for the top players, and sort through specific players based on specific data. Before, the library would use getQBData(), getRBData(), and getWRData() to simply return DataFrames ranked and sorted based on factors that I personally thought were the most relevant. However, now, users can use getQBData(metrics), getRushData(metrics), and getRecMetrics(metrics) to sort QBs, receivers, and runners based on specified parameters (ex. Yds, Att), and receiving and rushing are both not limited to one position, but include all rushers and receivers across the league (ex. Rushing Data can include QBs, RBs, and WRs even), which finally allows us to incorporate players like Travis Kelce into the receiving data.

Further, an aggregate scoring method was also implemented, where users can specify a position to get a DataFrame that holds the top positional players in terms of Rushing Touchdowns, Receiving Touchdowns, and Total Touchdowns, which can be very helpful in terms of fantasy. .. note:

This project is under active development.

How to Install Library

To install the library, navigate to your console/terminal and run the command pip install fantasyfootball-crawler

Then, add this statement to the top of your script: import fantasyfootball-crawler

Then, you can use the functions! They are listed below.

How to Use Library

To use the library, call the functions in functions after you've installed the library. Make sure to import them into your code files first.

Get QB Data

Users can call getQBData(metrics) with specified throwing metrics, to return a DataFrame that sorts based on the throwing metrics.

metrics: An array of strings that specify specific metrics to sort players by. Can be any combination of these strings: Player Age QBR Cmp% Yds TD Int

Examples are in Functions and Docstrings

Get Rushing Data

Users can call getRushData(metrics) with specified rushing metrics, to return a DataFrame that sorts based on the rushing metrics.

metrics: An array of strings that specify specific metrics to sort players by. Can be any combination of these strings: Player Tm Age Pos G GS Att Yds TD 1D Lng Y/A Y/G Fmb

Examples are in Functions and Docstrings

Get Receiving Data

Users can call getRecData(metrics) with specified receiving metrics, to return a DataFrame that sorts based on the receiving metrics.

metrics: An array of strings that specify specific metrics to sort players by. Can be any combination of these strings: Player Age Pos Tgt Rec Yds TD

Examples are in Functions and Docstrings

Get Scoring Data

Users can call getScoringData(pos) with a specified position, to see the top touchdown scorers at each position: QB, RB, WR, and K (most K don't score TD's though)

pos: A string that indicates the position specified, can be "QB", "RB", "WR", or "K"

Examples are in Functions and Docstrings

Weighted Rankings

Users can call weightedRankings(df, weights) with a specified DF, and sort them with the corresponding weights. For most people, they can call another function, like getQBData() for example, to get a DataFrame, and then input their desired weights.

'df': A DataFrame with the statistics and corresponding players 'weights': An integer array that is the same size as the number of columns in df

Examples are in Functions and Docstrings

Functions and Docstrings

ff_functions.getQBData(metrics)

Returns a DataFrame of the best QB's and their various stats, filtered and ordered on specific variables

String Array

Metrics, a String Array of Metrics used to sort the dataframe, from the given statistics in the DF.

DataFrame

A a DataFrame of the best QB's and their various stats, filtered and ordered on specific variables

>>> print(getQBData(["TD", "Cmp%"]))
                Player  Age   QBR   Cmp%   Yds  TD  Int
                0    Patrick Mahomes*+   27  77.6   67.1  5250  41   12
                4          Joe Burrow*   26  58.7   68.3  4475  35   12
                6          Josh Allen*   26  71.4   63.3  4283  35   14
                7          Geno Smith*   32  60.8   69.8  4282  30   11
                3        Kirk Cousins*   34  49.9   65.9  4547  29   14
>>> print(getQBData(["Int", "Age"]))
               Player  Age    QBR   Cmp%   Yds  TD  Int
                19           Dak Prescott   29   57.9   66.2  2860  23   15
                15            Davis Mills   24   33.1   61.0  3118  17   15
                3           Kirk Cousins*   34   49.9   65.9  4547  29   14
                13            Derek Carr*   31   55.5   60.8  3522  24   14
                6             Josh Allen*   26   71.4   63.3  4283  35   14
ff_functions.getRecData(metrics)

Returns a DataFrame of the best receivers and their various stats, filtered and ordered on specific variables

String Array

Metrics, a String Array of Metrics used to sort the dataframe, from the given statistics in the DF.

DataFrame

A a DataFrame of the best receivers (yes, that includes Travis Kelce) and their various stats, filtered and ordered on specific variables

>>> print(getRecData(["Tgt", "Rec"]))
            Player Age Pos  Tgt  Rec   Yds  TD
            7   Davante Adams*+  30  WR  180  100  1516  14
            0     Tyreek Hill*+  28  WR  170  119  1710   7
            4      CeeDee Lamb*  23  WR  156  107  1359   9
            2     Stefon Diggs*  29  WR  154  108  1429  11
            14  Diontae Johnson  26  WR  147   86   882   0
>>> print(getRecData(["TD", "Yds"]))
            Player Age Pos  Tgt  Rec   Yds  TD
            7        Davante Adams*+  30  WR  180  100  1516  14
            11           A.J. Brown*  25  WR  145   88  1496  11
            2          Stefon Diggs*  29  WR  154  108  1429  11
            4           CeeDee Lamb*  23  WR  156  107  1359   9
            21          Amari Cooper  28  WR  132   78  1160   9
ff_functions.getRushData(metrics)

Returns a DataFrame of the best RB's and their various stats, filtered and ordered on specific variables

String Array

Metrics, a String Array of Metrics used to sort the dataframe, from the given statistics in the DF.

DataFrame

A a DataFrame of the best RB's and their various stats, filtered and ordered on specific variables

>>> print(getRushData(["Yds", "Att"]))
            Player   Tm  Age Pos   G  GS  Att   Yds  TD  1D Lng  Y/A   Y/G Fmb
            1    Josh Jacobs*+  LVR   24  RB  17  17  340  1653  12  93  86  4.9  97.2   3
            0  Derrick Henry *  TEN   28  RB  16  16  349  1538  13  65  56  4.4  96.1   6
            2      Nick Chubb*  CLE   27  RB  17  17  302  1525  12  69  41  5.0  89.7   1
            3  Saquon Barkley*  NYG   25  RB  16  16  295  1312  10  62  68  4.4  82.0   1
            7   Miles Sanders*  PHI   25  RB  17  15  259  1269  11  62  40  4.9  74.6   2
>>> print(getRushData(["Att", "Y/A"]))
            Player    Tm  Age   Pos   G    GS  Att   Yds  TD  1D  Lng  Y/A   Y/G  Fmb
            0   Derrick Henry*   TEN   28    RB  16    16  349  1538  13  65   56  4.4  96.1    6
            1   Josh Jacobs*+   LVR   24    RB  17    17  340  1653  12  93   86  4.9  97.2    3
            2   Nick Chubb*   CLE   27    RB  17    17  302  1525  12  69   41  5.0  89.7    1
            3   Saquon Barkley*   NYG   25    RB  16    16  295  1312  10  62   68  4.4  82.0    1
            4   Najee Harris   PIT   24    RB  17    17  272  1034   7  45   36  3.8  60.8    3
ff_functions.getScoringData(pos)

Returns a DataFrame of the highest point scorers in the NFL, of RB, WR, and K, depending on the parameter given.

String

Pos string, which determines which position to show the top scorers for

DataFrame

a DataFrame of the highest point scorers in the NFL, of RB, WR, and K, depending on the parameter given.

>>> print(getScoringData("WR"))
            Player  RshTD  RecTD  TotalTD
            31         Davante Adams*+      0     14       14
            44           Stefon Diggs*      0     11       11
            43             A.J. Brown*      0     11       11
            52      Justin Jefferson*+      1      8        9
            53          Ja'Marr Chase*      0      9        9
>>> print(getScoringData("QB"))
            Player  RshTD  RecTD  TotalTD
            33         Jalen Hurts*     13      0       13
            67        Justin Fields      8      0        8
            70          Josh Allen*      7      0        7
            78         Daniel Jones      7      0        7
            112         Joe Burrow*      5      0        5
ff_functions.weightedRankings(df, weights)

Returns a DataFrame of the best players in the NFL depending on statistical weighting

String

df, a DataFrame that is generated by some of the other functons, or user input weights, an array of floats, adding up to 1, that define the weight of each column in the df

DataFrame

a DataFrame of the best players in the NFL depending on statistical weighting

>>> df = getQBData(["TD"])
>>> print(weightedRankings(df, [0.1, 0.4, 0.1, 0.3, 0.1 , 0.1, 0.1]))
            Player  Age   QBR   Cmp%   Yds  TD  Int  weighted
            0    Patrick Mahomes*+   27  77.6   67.1  5250  41   12    568.99
            8     Trevor Lawrence*   23  54.5   66.3  4113  25    8    516.09
            7          Geno Smith*   32  60.8   69.8  4282  30   11    513.28
            4          Joe Burrow*   26  58.7   68.3  4475  35   12    497.36
            1       Justin Herbert   24  58.2   68.2  4739  25   10    488.96
>>> print(weightedRankings(df, [0.25, 0.25, 0.25, 0.25, 0.0 , 0.0, 0.0]))
                Player  Age   QBR   Cmp%  Yds  TD  Int  weighted
            55      Joshua Dobbs   27  50.8   58.8  411   2    2    56.625
            58     Anthony Brown   24   0.0   44.9  302   0    2    56.500
            59      Malik Willis   23  12.4   50.8  276   0    3    56.000
            101  Phillip Dorsett   29   2.5    0.0    0   0    0    54.450
            49   Jarrett Stidham   26  57.8   63.9  656   4    3    44.675