def add_indicator(df):
"""
Purpose
-------
Add indicator column next to any column that has one or more NaNs.
The indicator column contains 1 at the index that has NaN in the parent data column.
The NaNs in the parent data columns are replaced with 0.
To scroll in screen session
Press "Ctrl-A" on the keyboard and press "Esc."
Press the "Up" and "Down" arrow keys or the "PgUp" and "PgDn" keys to scroll through previous output.
Press "Esc" to exit scrollback mode.
Screen output logging to a file
screen -L -S testscreen
Script to write tensorboard logs during execution.
import tensorflow as tf
a = tf.constant(2, name='a')
b = tf.constant(3, name='b')
x = tf.add(a,b, name='add')
writer = tf.summary.FileWriter('./graphs', tf.get_default_graph())
To get the index of a value in a list
indx = [i for i, v in enumerate(lis) if v == 1]
To merge dataframes when their indexes are same but may not be of equal length i.e. some samples may be missing in either of the df.
p_m_smi = pd.merge(p_smi, met_smi, left_index=True, right_index=True, how='outer', sort=False)
[left, right]_index : True to use indexes to merge on. For columns set left_on or right_on.
Outer: means union, Pandas will put NaN for the rows that are missing in either of the dataframes.
Sort: keep false if the dataframes are already sorted for efficiency.
To concatenate column wise
To check for avialable modules module avail
List the loaded modules module list
Job status: qstat -t -u username
This is a collection of basic "recipes", many using twurl (the Swiss Army Knife for the Twitter API!) and jq to query the Twitter API and format the results. Also, some scripts to test or automate common actions.