正しいトークンを入力しているにも関わらずinvalid credential[Jupyter]

Jupyter notebook初回起動の際,正しいトークンを入力しているにも関わらずinvalid credentialが出るときには以下を試してみよう.
configを生成.もし既に存在していて,上書きの確認が ...
再起動すると8888でないポートになる問題の対策[Jupyter]

jupyter notebook や jupyter labを2回以上起動すると,最初はデフォルトのポート8888で起動するのに,2回目以降は8889とか8890で起動するという困ったことがある.
そんな時は以下のコマンド ...
バージョンを指定してインストール[python][tensorflow]

pip install tensorflow-gpu==1.11.0
DataFrameから複数列を抽出[Python][Pandas]

import pandas as pddf = pd.read_csv("./train.csv")df = df]
pickleを使って変数をそのまま保存する[Python]

import pickleimport numpy as nparr = np.zeros(100)with open("arr.pickle", "wb") as f:pickle.dump(arr, f)
自作ELMoで単語をEmbeddingした後,Numpyに戻す[Flair][NLP]

from flair.embeddings import ELMoEmbeddingsfrom flair.data import Sentence# ELMoのモデルは各自で用意options = '/home/ubuntu/elmo-e ...
ファイル名に日付を記録するときの書き方[Python]

import datetimedt = datetime.datetime.now()dt = dt.strftime('%Y-%m-%d_%H%M%S')df.to_csv(dt + "_data.csv")>> 2020-0 ...
空のDataFrameに1行ずつデータを追加[pandas]

サンプル
import pandas as pddf = pd.DataFrame()for i in range(5): tmp_series = pd.Series() df = df.append(tmp_series, ...コマンドラインでNvidia-driverをインストールする4行で[GPU]

# 以前にインストールしたことがある場合は以下の2行を追加で実行sudo apt-get purge nvidia-*sudo apt-get purge cuda-*sudo add-apt-repository ppa:graphics ...
pathlibを使うとglobもopenも使わずにテキスト処理ができる[Python]

これまで特定のフォルダ内にあるテキストファイルを処理するときは、以下のようにglobをインポートして、ファイルパスのリストを作成した後に、with openでテキストを読み込むということをしていた。
from glob impo ...