This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git rebase --interactive HEAD~2 | |
| # we are going to squash c into b | |
| pick b76d157 b | |
| pick a931ac7 c | |
| # squash c into b | |
| pick b76d157 b | |
| s a931ac7 c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function obj(o) { | |
| function F() {} | |
| F.prototype = o; | |
| return new F(); | |
| } | |
| function inheritPrototype(sub, sup) { | |
| var p = obj(sup.prototype); | |
| p.constructor = sub; | |
| sub.prototype = p; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #List unique values in a DataFrame column | |
| pd.unique(df.column_name.ravel()) | |
| #Convert Series datatype to numeric, getting rid of any non-numeric values | |
| df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True) | |
| #Grab DataFrame rows where column has certain values | |
| valuelist = ['value1', 'value2', 'value3'] | |
| df = df[df.column.isin(value_list)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1. Use your editor to write queries: | |
| # Tell the terminal what editory to use | |
| $ export EDITOR=subl | |
| # Then in psql type: | |
| psql> \e | |
| # It will open SublimeText with the last query. | |
| # Close the file and the query will run. | |
| # 2. Turn too long columns into lines: |