Slack通知、2行で [Python]

import slackwebslack = slackweb.Slack(url="Webhook URL")slack.notify(text="This is message for you.")
参照
リストからDataFrameを生成[Pandas]

本記事では,値をデータフレームを入力し,そのあとカラム名とインデックス名を決める流れで生成を行う方法を紹介.
それぞれの列をリストとし,その2次元リストからDataFrameを作成する場合pd.DataFrameの際,転置 ...
バージョンを指定してインストール[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)
ファイル名に日付を記録するときの書き方[Python]

import datetimedt = datetime.datetime.now()dt = dt.strftime('%Y-%m-%d_%H%M%S')df.to_csv(dt + "_data.csv")>> 2020-0 ...
pathlibを使うとglobもopenも使わずにテキスト処理ができる[Python]

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

sudo python xxx.pyでスクリプトを実行した時,ライブラリが見つからないことがあった.
こういう時はwhichコマンドを使って,普段のpythonの絶対パスを調べる.
which python>/ ...新しい環境にPython環境を準備[python]

Ubuntu16.04だと,2系と3系のpythonが混在しているため,pyenvで環境を作る.
必要なパッケージのインストール
sudo apt install -y git openssl libssl-dev ...周期表をハードコーディングした[Python]

手打ちで作って大変だったため記録.
下をコピペし、Pythonでリストとして変数に格納すれば、そのままの形で使えるはずです。
間違いがあれば、コメントをいただけると大変助かります。
periodic_ta ...