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
def change_datatype(df): | |
int_cols = list(df.select_dtypes(include=['int']).columns) | |
for col in int_cols: | |
if ((np.max(df[col]) <= 127) and(np.min(df[col] >= -128))): | |
df[col] = df[col].astype(np.int8) | |
elif ((np.max(df[col]) <= 32767) and(np.min(df[col] >= -32768))): | |
df[col] = df[col].astype(np.int16) | |
elif ((np.max(df[col]) <= 2147483647) and(np.min(df[col] >= -2147483648))): | |
df[col] = df[col].astype(np.int32) | |
else: |
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
#!/bin/bash | |
# copy this file into /bin/zcat to a file called /bin/7zcat | |
PATH=${GZIP_BINDIR-'/bin'}:$PATH | |
exec 7z e -so -bd "$@" 2>/dev/null | cat |
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
python -m ipykernel install --user --name=my-virtualenv-name --display-name "Python 3 (my-virtualenv)" | |
jupyter notebook |
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
if [ -n "$LD_LIBRARY_PATH" ]; then | |
old_PATH=$LD_LIBRARY_PATH:; LD_LIBRARY_PATH= | |
while [ -n "$old_PATH" ]; do | |
x=${old_PATH%%:*} # the first remaining entry | |
case $LD_LIBRARY_PATH: in | |
*:"$x":*) ;; # already there | |
*) LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$x;; # not there yet | |
esac | |
old_PATH=${old_PATH#*:} | |
done |
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 [maxtab, mintab]=peakdet(v, delta, x) | |
%PEAKDET Detect peaks in a vector | |
% [MAXTAB, MINTAB] = PEAKDET(V, DELTA) finds the local | |
% maxima and minima ("peaks") in the vector V. | |
% MAXTAB and MINTAB consists of two columns. Column 1 | |
% contains indices in V, and column 2 the found values. | |
% | |
% With [MAXTAB, MINTAB] = PEAKDET(V, DELTA, X) the indices | |
% in MAXTAB and MINTAB are replaced with the corresponding | |
% X-values. |