Skip to content

Instantly share code, notes, and snippets.

Jeff Hale discdiver

View GitHub Profile
@discdiver
discdiver / common_pandas_errors.md
Last active Apr 8, 2020
Common Pandas Errors
View common_pandas_errors.md

Common Pandas Errors

By Jeff Hale

March 2020

Pandas Version 1.0.1

See the Source file here: https://github.com/discdiver/pandas_errors

Each error is explained, and example is shown, and then the correct code is shown, if applicable.

@discdiver
discdiver / git_branch.md
Last active May 2, 2020
Basic Git Workflow with Local Branches and Pushing Directly to the Master Branch
View git_branch.md

Basic Git Branching Workflow

There are many potential Git workflows. The following is a basic workflow for someone working alone, using different local branches, pushing directly the master remote branch.

To make a new branch locally:

  1. git checkout -b my_branch_name - create and move to a new branch
  2. Do work.
  3. git status - check on things.
  4. git add . - stage changes to be committed.
  5. git commit -m "my_commit-message" - commit changes.
@discdiver
discdiver / git_fork_clone_sync.md
Last active Mar 19, 2020
Forking, Cloning, and Syncing with Git and GitHub
View git_fork_clone_sync.md

How to fork, clone, and sync from a GitHub repository.

  1. From the GitHub GUI: Fork the repository (click fork).
  2. From your forked repository in the GitHub GUI: Click clone and copy the URL.
  3. From the command line: in the directory you want to put your local copy of the repository, type git clone insert_the_url_from_above
  4. cd into the cloned repository
  5. git remote -v to see the tracking versions. You should see origin, but no upstream.
  6. From the original repository in the GitHub GUI (not yours): Click clone and copy the URL.
  7. git remote add upstream insert_url_of_original_repository_from_the_step_above
  8. git remote -v to verify you have origin and upstream repositories.
@discdiver
discdiver / jupyterlab_shortcuts.md
Last active May 1, 2020
Common Jupyter Lab Keyboard Shortcuts
View jupyterlab_shortcuts.md

Note, if you are on a Mac, substitute command for control. Don't type the + (it means press both keys at once).

Shortcuts when in either command mode (outside the cells) or edit mode (inside a cell):

  • Shift + Enter run selected cells

  • Ctrl + S save and checkpoint

  • Ctrl + Shift + S save as

  • Ctrl + B toggles hide/show left sidebar

@discdiver
discdiver / intersting_ds_examples.md
Created Jan 16, 2020
Interesting Data Science in Real Life Examples
View intersting_ds_examples.md
@discdiver
discdiver / conda-commands.md
Last active May 26, 2020
Common conda and venv commands
View conda-commands.md

Common conda commands:

Create environment

conda create -n myenv pandas jupyterlab Create a new conda environment named myenv and have pandas and jupyterlab installed into it.

conda create --name myclone --clone myenv Clone an environment named myenv into the new environment myclone.

Activate and deactivate environment

conda activate myenv Activate the myenv environment.

View plotly_globe_figure_example.py
import pandas as pd
import numpy as np
import plotly.offline as py
import plotly.graph_objs as go
import json
py.init_notebook_mode(connected=False)
izip = zip
@discdiver
discdiver / k8s-example-deployment.yaml
Last active Apr 6, 2019
Part of a series of k8s examples.
View k8s-example-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
View k8s_deployment_with_service_comments.yaml
apiVersion: apps/v1 # Deployments get an "apps/v1" - no longer in beta.
kind: Deployment # kind is for the type of resource.
metadata: # metadata provides information about the resource.
name: my-deployment # We name our Deployment my-deployment.
#This is the value at metadata.name.
spec:
replicas: 3 # Specify we want 3 Pods in our ReplicaSet.
selector:
matchLabels: # spec.selector.matchLabels tells the Deployment
app: my-app # to match Pods with a key - value label pair
@discdiver
discdiver / k8s_deployment_with_service.yaml
Last active Apr 5, 2019
Specification for a Kubernetes Deployment and Service
View k8s_deployment_with_service.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
You can’t perform that action at this time.