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())
with tf.Session() as sess:
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 get the index of a value in a list
indx = [i for i, v in enumerate(lis) if v == 1]
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 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
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.
Stack Pictures Vertically
convert png_print/Accuracy_print.png png_print/AdaBoost_print.png -resize '1024x682^' -bordercolor black -border 2 -gravity center -append test.png