Skip to content

Instantly share code, notes, and snippets.

@ahgraber
Last active April 5, 2021 12:36
Show Gist options
  • Save ahgraber/2611025feda2faea63db6098dd897393 to your computer and use it in GitHub Desktop.
Save ahgraber/2611025feda2faea63db6098dd897393 to your computer and use it in GitHub Desktop.

Python

Learn Python

Pandas

Matplotlib

Coding

Python conventions:

https://www.python.org/dev/peps/pep-0008/, and Google Style Guide but generally speaking -- be consistent, comment often, and writer readable code:

  • Favor additional whitespace for readability: (x + y) vs. (x+y)
  • Trailing commas are OK: [a, b, c, d,]
  • short, lowercase names for packages/modules
  • CapWords for classes
  • lower_case for functions and variables

Docstrings

Clean Code

Unit Testing

Data Mgmt & Feature Engineering

Data Mgmt

Feature Engineering

Feature Importance

.ipynb and git

  • Install jq Steps: Download 'jq' (and note where you saved it).  For Windows, install with chocolatey. (*nix) Add the following to ~/.gitconfig
[core]
   attributesfile = ~/.gitattributes_global

[filter "nbstrip_full"]
   clean = "jq --indent 1 \
            '(.cells[] | select(has(\"outputs\")) | .outputs) = []  \
            | (.cells[] | select(has(\"execution_count\")) | .execution_count) = null  \
            | .metadata = {\"language_info\": {\"name\": \"python\", \"pygments_lexer\": \"ipython3\"}} \
            | .cells[].metadata = {} \
            '"
    smudge = cat
    required = true

(windows) Add the following to C:\Users<username>.gitconfig . Alter the path at "clean = " for your 'jq' save location.

[core]
    attributesfile = C:\\Users\\<username>\\.gitattributes_global

[filter "nbstrip_full"]
    clean = "jq --indent 1 \
            '(.cells[] | select(has(\"outputs\")) | .outputs) = []  \
            | (.cells[] | select(has(\"execution_count\")) | .execution_count) = null  \
            | .metadata = {\"language_info\": {\"name\": \"python\", \"pygments_lexer\": \"ipython3\"}} \
            | .cells[].metadata = {} \
            '"
    smudge = cat		
    required = true

Add the following to ~/.gitattributes_global or C:\Users<username>.gitattributes_global

*.ipynb filter=nbstrip_full

References: 

Analytics

ML Algos

ML Ops

[MLFlow] Kedro Kedro + MLFlow Workflow discussion/example Aggregator References: Awesome Production ML Production Level Deep Learning Lessons Learned

Interview Prep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment