2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pythonチートシート

Posted at

#windowsで仮想環境をつくる

目的のフォルダに移動するコマンドたち

lsに当たるもの

dir

cd に当たるもの

cd

所定のフォルダに入ったらactivateを起動する

hoge\Scripts\activate 

deactivateで仮想環境をシュル用

(hoge) # hoge\Scripts\deactivate 

#pandsでエクセル操作

エクエルの読み出し

Xlsx = "hoge.xlsx"
Xlsx_SheetName = "hogehoge"
Xlsx_Data = pd.read_excel(Xlsx, sheet_name=Xlsx_SheetName)

エクセル書き出し

writer = pd.ExcelWriter("Result.xlsx")
Xlsx_Data.to_excel(writer, sheet_name="hoge1")
writer.save()

for文で処理するとき

for Index,Row in Xlsx_Data.iterrows():

一行づつ処理する部分を書く

pandasに一列加える

hoge列を加える

Xlsx_Data["hoge"] = pd.DataFrame(hoge_list)

#文字列操作

##Emailからドメインだけを抜き出す

import re
pattern = "(.*)@(.*)"
Domain = re.search(pattern,Email_String).group(2)
#re.search(pattern,Email_String).group(1)だと@前が取り出せる
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?