git checkout master to be in master
git merge <branch> to merge in the other branch, will tell you that can't auto-merge
git mergetool brings up a vim window with:
+--------------------------------+
| import tempfile | |
| import zipfile | |
| # make archive.zip in temp directory | |
| tmpdir = tempfile.mkdtemp() | |
| zip_fn = os.path.join(tmpdir, 'archive.zip') | |
| zip_obj = zipfile.ZipFile(zip_fn, 'w') | |
| for f in files: | |
| zip_obj.write(f, os.path.basename(f)) # add file to archive, second argument is the structure to be represented in zip archive, i.e. this just makes flat strucutre |
| # case when | |
| from sqlalchemy import case | |
| d = s.query(config_db.ClinicalIndication.clinical_indication_uid, | |
| case([(config_db.ClinicalIndication.clinical_indication_code.startswith('M'), 'C'), | |
| (config_db.ClinicalIndication.clinical_indication_code.startswith('R'), 'R')], | |
| else_ = None).label('programme')).all() | |
| # convert query to pandas df | |
| import pandas as pd | |
| pd.DataFrame(q.all(), columns = ['col1', 'col2']) |
| read_in_xlsx <- function(f) { | |
| # read in an Excel file into a dataframe | |
| require(openxlsx) | |
| d <- read.xlsx(f) | |
| cat(paste0(f, " - ", nrow(d), "Rx", ncol(d), "C\n")) | |
| return(d) | |
| } |
| -- Index from query | |
| psql metrics -h 10.1.24.39 -p 5433 -U cdt_user | |
| -- Index from local | |
| psql metrics -h localhost -p 5441 -U cdt_user | |
| -- local postgres | |
| psql metrics -h localhost -p 5432 -U cdt_user |
| import pandas as pd | |
| raw_data = {'first_name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'], | |
| 'last_name': ['Miller', 'Jacobson', 'Ali', 'Milner', 'Cooze'], | |
| 'age': [42, 52, 36, 24, 73], | |
| 'preTestScore': [4, 24, 31, 2, 3], | |
| 'postTestScore': [25, 94, 57, 62, 70]} | |
| df = pd.DataFrame(raw_data, columns = ['first_name', 'last_name', 'age', 'preTestScore', 'postTestScore']) |
| from tempfile import NamedTemporaryFile | |
| import webbrowser | |
| base_html = """ | |
| <!doctype html> | |
| <html><head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
| <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> | |
| <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.css"> | |
| <script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.js"></script> |
| FUNCTION | DESCRIPTION |
|---|---|
| index() | Method returns index (row labels) of the DataFrame |
| insert() | Method inserts a column into a DataFrame |
| add() | Method returns addition of dataframe and other, element-wise (binary operator add) |
| sub() | Method returns subtraction of dataframe and other, element-wise (binary operator sub) |
| mul() | Method returns multiplication of dataframe and other, element-wise (binary operator mul) |
| div() | Method returns floating division of dataframe and other, element-wise (binary operator truediv) |
| unique() | Method extracts the unique values in the dataframe |
| nunique() | Method returns count of the unique values in the dataframe |
git stash list see what is in the stash listgit stash show -p see full diff of the stash (add specific stash, otherwise will be most recent)git stash stash all changes to tracked files and revert to HEAD, add -m <message> to give an accompany description, and can specify some filepaths to limit the stash togit stash -p go through hunk by hunk and decided what to stash| SELECT * FROM (VALUES (1, 'one'), (2, 'two'), (3, 'three')) AS t (num,letter); |