Python

Thumbnail of post image 048

インストール

pip install pyyaml

まずは、config.yamlを作成

# config.yamln_class: 10xml_path:/home/ubuntu/disk/xml

次にconfi ...

Pandas,Python

Thumbnail of post image 180

from pathlib import Pathdef txt_to_df(str_txt): # TXTをDataframeに変換する、何らかの処理 return dftxt_path = Path("./txt/")all_df = p ...

Python

Thumbnail of post image 009

ElsevierやSpringerなどのオンラインジャーナルは、一般的に、論文がXMLで提供されている。XMLで提供された論文からは、タイトルやアブストラクトや本文が取り出しやすいため、テキスト解析に重宝する。

今回はXM ...

Python

Thumbnail of post image 131

from datetime import datetimedatetime.now().strftime("%Y-%m-%d-%H-%M-%S")>>'2020-07-15-05-15-42'

Uncategorized

Thumbnail of post image 074

以下に3つのdataframe生成し、結合するスクリプトを示す。
pd.concatを使うと、dataframeを縦連結することができる。あまり使わないと思うが、axisのオプションで横連結にすることも可能だ。

impo ...

Uncategorized

Thumbnail of post image 085

name_list = d = {}for name in name_list: len_name = len(name) head_name = name d.setdefault(name, ()).append((len_name, ...

Pandas

Thumbnail of post image 061

サンプル

import pandas as pddf = pd.DataFrame()for i in range(5): tmp_series = pd.Series() df = df.append(tmp_series, ...

Python

Thumbnail of post image 075

import collectionsimport matplotlib.pyplot as pltl = c = collections.Counter(l)plt.bar(list(c.keys()), list(c.values())) ...

PyTorch

Thumbnail of post image 076

from glob import globfrom PIL import Imageimport numpy as npimport torchimport torch.utils.data as data_utilsfrom torchv ...

Pandas,Python

Thumbnail of post image 135

hogeというフォルダの中に複数のCSVが配置されているとき、

以下のコードで複数のCSVを一つのDataFrame(表)としてまとめることが可能

from glob import globimport pandas ...