Skip to main content

No project description provided

Project description

## Terminology
1. **Subject**: A field that is grouped on; analogous to SQL's "GROUP BY"
2. **Split**: A filter used to restrict a dataset; analogous to SQL's "WHERE"
* **vs LHH**: "versus left-handed hitters"
* **vs RHH**: "versus right-handed hitters"
* **vs LHP**: "versus left-handed pitchers"
* **vs RHP**: "versus right-handed pitchers"
3. **Stat**: A metric that is calculated from the aggregated data. There are
four basic stats to be calculated that should be familiar to any baseball fan.

## Instructions
1. Create a GitLab account (if you don't already have one).
2. Clone this repository to your machine.
3. Install it using `pip install -r requirements.txt`
3. Modify to perform the following steps when called via `python`:
1. Read in `./data/raw/pitchdata.csv`
2. Perform grouping/aggregations of each combination from
`./data/reference/combinations.txt` to create tables/dataframes.
3. Round the stat to a max of three decimal places.
4. Only include subjects with PA >= 25.
5. Combine each individual table/dataframe into a single one with the
following column headers:
* SubjectId _(e.g. 108, 119, etc)_
* Stat _(e.g. the name of the stat "AVG", "OBP", etc.)_
* Split _(e.g. "vs LHP", "vs RHH", etc.)_
* Subject _(e.g. "HitterId", "PitcherTeamId", etc.)_
* Value _(e.g. the value of the Stat 0.350, 1.03, 0.5, etc)_
6. Sort the table/dataframe on the first four columns (each in ascending
7. Save the csv to `./data/processed/output.csv`
4. Run the test suite by opening a command-line, cd in to the repo, and running
the following command: ```pytest -v```
5. Upload to a new repository under your own GitLab/GitHub/BitBucket account.
6. Email the link to your repository to Andrew Pautz (

## Example
Let's take the first combination to be processed from combinations.txt:
AVG,HitterId,vs RHP
... the equivalent SQL would look something like:

HitterId AS SubjectId,
'AVG' AS Stat,
'vs RHP' AS Split,
'HitterId' AS Subject,
FROM ./data/raw/pitchdata.csv
WHERE PitcherSide = 'R'

## Goals
Your submission will be scored on 5 aspects:
1. **Accuracy**: The output data must be 100% accurate.
2. **Readability**: The easier it is to understand, the better.
3. **Performant**: It should ideally take just 1-2 seconds to finish.
4. **Development Time**: Try to submit within a day.
5. **Installable**: Make it installable via `pip install -r requirements.txt`

## Additional Info
* Use any third party libraries you'd like so long as they're installed via
the requirements.txt file. We use pandas heavily, but if you're more
comfortable using numpy or something entirely else feel free to do so.
* You don't need to limit your modifications to You can add/edit any
other file in the repo with the exception of anything in:
* ./tests
* ./data/raw
* ./data/reference
* Code should generally be pep8 compliant.
* Documentation isn't required, but wouldn't be frowned upon.
* If you need to go a bit over 80 chars ... no problem.

Project details

Release history Release notifications

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for PythonHiringTest, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size PythonHiringTest-1.1.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page