NLTKのコーパスを用いたStopWord除去(英語)[Python][NLP]
In : from nltk.corpus import stopwordsIn : stopWords = stopwords.words('english')In : stopWordsOut: In: len(stopWords)Ou ...
GrovePiをRaspi 3B+に取り付けて簡単にLチカを行う[Grove][Python][RaspberryPi]
Groveとは?
用意したもの
GrovePi+シールドをRaspberry Piに取り付ける
GrovePiのソースコードをダウンロード&インストール
GrovePi+シールドにLEDモジュールを取り付ける ...
用意したもの
GrovePi+シールドをRaspberry Piに取り付ける
GrovePiのソースコードをダウンロード&インストール
GrovePi+シールドにLEDモジュールを取り付ける ...
ワールドカードでタグ検索
# 必要なモジュールのインポートimport BeautifulSoupimport retry:# Python 3from urllib import requestexcept ImportError:# Python 2import ...
フォルダ内のファイルを特定の割合に分ける[Python]
なんでこんなことするの?
CNNで学習するために、画像ファイルをTrainingとValidationに分けたかったから。
画像ファイルを7:3に分けるスクリプトfrom glob import globfrom os.path ...PILで透過PNGのαチャンネルを消す方法[Python][PIL][RGBA]
In: from PIL import ImageIn: img_pil = Image.open("hoge.png")In: img_pil.mode Out: 'RGBA'In: img_pil = img_pil.convert(" ...
find_allの後にfind_allしたいとき[Python] [Beautiful soup]
Beautiful soupでパースしたオブジェクトにfind_allの後にfind_allをするとエラーが出る.# エラーがでる例soup = BeautifulSoup(html, "html.parser")obj = soup.fi ...
Win版AnacondaでPermission deniedがでたときの対処法
Anaconda Prompt上で以下のコマンドを打つだけでOK
(標準のCommand PromptやWindows Power Shellではない)
anaconda-navigator --resetGraphvizで描いたノードに画像を貼り付ける(Pythonで)
ノードの引数に貼り付けたい画像のバスを書くだけ。
from graphviz import Digraph# Ready to parent graph.g = Digraph(comment = 'Graph')g.node( ...Pythonの実行環境を構築したDockerコンテナに入ってコマンド実行
Pythonの実行環境を構築したDockerコンテナに入ってコマンド実行
$ docker exec hoge-container python hoge.py arg1 arg2hoge-container: Pytho ...
Jupyter Notebook の初回起動時のワーキングディレクトリを変更
# configファイルの作成$ jupyter notebook --generate-config# geditでconfigファイルを開き、c.NotebookApp.notebook_dirの変数に好きな場所に書き換える$ gedi ...