force the remove of the image even if it is used by containers or having multiple tags
docker rmi -f
# If you want to filter rows by a certain number of columns with null values, you may use this: | |
df.iloc[df[(df.isnull().sum(axis=1) >= qty_of_nuls)].index] | |
# update each value in column while iterating over the dataframe row by row | |
for index_label, row_series in df.iterrows(): | |
# For each row update the 'Bonus' value to it's double | |
df.at[index_label, 'Bonus'] = row_series['Bonus'] * 2 | |
# select column by multiple range | |
df_10_2_rank.iloc[:, np.r_[0,16:31]] |
## THE CODE IS SELF EXPLANATORY AND COMMENTED | |
## loading some dependencies | |
import gensim | |
from gensim.utils import simple_preprocess | |
from gensim.parsing.preprocessing import STOPWORDS | |
from nltk.stem import WordNetLemmatizer, SnowballStemmer | |
from nltk.stem.porter import * | |
import nltk | |
nltk.download('wordnet') |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
# Path to your oh-my-zsh installation. | |
export ZSH="/home/zhibo/.oh-my-zsh" | |
# Set name of the theme to load --- if set to "random", it will | |
# load a random theme each time oh-my-zsh is loaded, in which case, | |
# to know which specific one was loaded, run: echo $RANDOM_THEME | |
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes |
set nocompatible " not vi compatible | |
syntax on " enable syntax processing | |
" Spaces & Tabs | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
set tabstop=4 " number of visual spaces per TAB | |
set softtabstop=4 " number of spaces in tab when editing | |
set shiftwidth=4 " Insert 4 spaces on a tab | |
set expandtab " tabs are spaces, mainly because of python |
w Go to the beginning of next word | |
e Go to the end of current word | |
b Go to the beginning of previous word | |
0 Go to the starting of current line | |
$ Go to the end of current line | |
g_ Go to the last non blank character of current line | |
H Go to the first line of current screen. | |
L Go to the last line of current screen | |
gg Go to the top of the file |
from tabulate import tabulate | |
print(tabulate(df, tablefmt="plain")) | |
''' | |
Supported table formats are: | |
"plain" | |
"simple" | |
"github" | |
"grid" |
python -m ipykernel install --user --name thisenv |
import tensorflow as tf | |
print(tf.test.is_built_with_cuda()) | |
from tensorflow.python.client import device_lib | |
print(device_lib.list_local_devices()) |
force the remove of the image even if it is used by containers or having multiple tags
docker rmi -f
# PyTorch device | |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") | |
X = torch.randn(n_points, 2).to(device) |