account_codes_jp package

class account_codes_jp.AccountType(*values)[source]

Bases: StrEnum

Asset = '資産'

資産(借方/賃借対照表)

Equity = '純資産'

純資産(貸方/賃借対照表)

Expense = '費用'

費用(借方/損益計算書)

Liability = '負債'

負債(貸方/賃借対照表)

Revenue = '収益'

収益(貸方/損益計算書)

Sundry = '諸口'

諸口

property debit: bool | None

借方(左)ならTrue, 貸方(右)ならFalse, 諸口ならNone

property static: bool | None

賃借対照表ならTrue, 損益計算書ならFalse, 諸口ならNone

class account_codes_jp.ETaxAccountProtocol(*args, **kwargs)[source]

Bases: Protocol

abstract: bool

抽象かどうか >>> from account_codes_jp import get_etax_accounts >>> df = get_etax_accounts() >>> (df[“duration”] == df[“abstract”]).describe() count 3736 unique 1 top True freq 3736 dtype: object >>> from account_codes_jp import get_etax_accounts >>> df = get_etax_accounts() >>> df.loc[(df[“title”] != df[“abstract”]), “label”].unique() array([‘貸借対照表’], dtype=object)

account_type: Literal[None, '資産', '流動資産', '固定資産', '有形固定資産', '無形固定資産', '投資その他の資産', '繰延資産', '負債', '流動負債', '固定負債', '特別法上の準備金等', '純資産', '株主資本', '資本金', '資本剰余金', '利益剰余金', '評価・換算差額等', '新株予約権', '売上高', '売上原価', '販売費及び一般管理費(売上原価)', '損益', 'その他', '販売費及び一般管理費', '営業外収益', '営業外費用', '特別利益', '特別損失', '収益', '費用']

EDINETの勘定科目リストで使用されている勘定科目を財務諸表規則に基づき区分したもの

code: str

貸借対照表のCSV形式データを作成するのに使用する勘定科目コード

debit: bool

借方かどうか(貸借区分)

depth: Literal[0, 1, 2, 3, 4, 5, 6, 7]

階層の深さ

duration: bool

持続かどうか(期間時点区分) >>> from account_codes_jp import get_etax_accounts >>> df = get_etax_accounts() >>> (df[“duration”] == df[“abstract”]).describe() count 3736 unique 1 top True freq 3736 dtype: object

element: str

要素名

etax: Literal[None, '資産', '流動資産', '固定資産', '有形固定資産', '無形固定資産', '投資その他の資産', '繰延資産', '負債', '流動負債', '固定負債', '特別法上の準備金等', '純資産', '株主資本', '資本金', '資本剰余金', '利益剰余金', '評価・換算差額等', '新株予約権', '売上高', '売上原価', '損益', 'その他', '販売費及び一般管理費', '営業外収益', '営業外費用', '特別利益', '特別損失']

e-Taxの勘定科目を財務諸表規則に基づき区分したもの

grounded: bool

会計基準及び業法等の法令規則に設定の根拠を有するか

industry: Literal['一般商工業', '建設業', '銀行・信託業', '銀行・信託業(特定取引勘定設置銀行)', '建設保証業', '第一種金融商品取引業', '生命保険業', '損害保険業', '鉄道事業', '海運事業', '高速道路事業', '電気通信事業', '電気事業', 'ガス事業', '資産流動化業', '投資運用業', '投資業', '特定金融業', '社会医療法人', '学校法人', '商品先物取引業', 'リース事業', '投資信託受益証券']

EDINETで設定されている業種目(23業種)

label: str

標準ラベル(日本語)

label_category: str

用途区分、財務諸表区分及び業種区分のラベル(日本語)

label_category_en: str

用途区分、財務諸表区分及び業種区分のラベル(英語)

label_en: str

標準ラベル(英語)

label_etax: str

EDINETの勘定科目リストで使用されている勘定科目及び勘定科目コードに対応する公表用e-Tax勘定科目(日本語)

label_etax_en: str

EDINETの勘定科目リストで使用されている勘定科目及び勘定科目コードに対応する公表用e-Tax勘定科目(日本語)

label_long: str

冗長ラベル(日本語)

label_long_en: str

冗長ラベル(英語)

prefix: Literal['jppfs_cor']

名前空間プレフィックス

substitution_group: Literal['xbrli:item', 'xbrldt:hypercubeItem']

代替グループ

title: bool

EDINETの勘定科目リストで冗長ラベルがタイトル項目 >>> from account_codes_jp import get_etax_accounts >>> df = get_etax_accounts() >>> df.loc[(df[“title”] != df[“abstract”]), “label”].unique() array([‘貸借対照表’], dtype=object)

total: bool

EDINETの勘定科目リストで用途区分が合計と使用できる

type: Literal['xbrli:stringItemType', 'xbrli:monetaryItemType']

データ型

account_codes_jp.get_account_ambiguous_factory(G: DiGraph) Callable[[str], str][source]

Estimate the correct account name from a possibly ambiguous account name.

Uses both literal and japanese phonetic matching.

Parameters:

G (nx.DiGraph) – The account tree

Returns:

A function that takes an account name and returns the closest match from the account tree

Return type:

Callable[[str], str]

account_codes_jp.get_account_type_factory(G: DiGraph, ambiguous: bool = False) Callable[[str], AccountType | None][source]

Get the account type from the account name

Parameters:
  • G (nx.DiGraph) – The account tree

  • ambiguous (bool, optional) – Whether to use the ambiguous account name resolver, by default False

Returns:

A function that takes an account name and returns the account type or None if the account is not found

Return type:

Callable[[str], AccountType | None]

account_codes_jp.get_blue_return_accounts(patch: Callable[[DiGraph], DiGraph] | None = None) DiGraph[source]

Get the blue return accounts as a graph

Parameters:

patch (Callable[[nx.DiGraph], nx.DiGraph], optional) – A function that takes the graph and returns the patched graph, by default None

Returns:

Tree representation of the blue return account list

Return type:

nx.DiGraph

account_codes_jp.get_edinet_accounts(industry: Literal['一般商工業', '建設業', '銀行・信託業', '銀行・信託業(特定取引勘定設置銀行)', '建設保証業', '第一種金融商品取引業', '生命保険業', '損害保険業', '鉄道事業', '海運事業', '高速道路事業', '電気通信事業', '電気事業', 'ガス事業', '資産流動化業', '投資運用業', '投資業', '特定金融業', '社会医療法人', '学校法人', '商品先物取引業', 'リース事業', '投資信託受益証券'] | None = None, debug_unique: bool = False, skip_non_line_elements: bool = True) DiGraph[source]

EDINETの勘定科目リストのDataFrameを取得する

Parameters:
  • industry (Industry | None, optional) – EDINETで設定されている業種目(23業種), by default None If None, all industries are returned.

  • debug_unique (bool, optional) – Whether to print unique values per column, by default False

  • skip_non_line_elements (bool, optional) – Whether to skip non-line elements, which was introduced due to the reference being the copy of EDINET account list, by default True

Returns:

DataFrame representation of the EDINET account list

Return type:

pd.DataFrame

account_codes_jp.get_node_from_label(G: DiGraph, label: str, cond: Callable[[Mapping[Any, Any]], bool] | None = None, multiple: bool = False) Any[source]

Get the node from the label and condition

Parameters:
  • G (nx.DiGraph) – The account tree

  • label (str) – The label of the node

  • cond (Callable[Mapping[Any, Any], bool]) – The condition to satisfy

  • multiple (bool, optional) – Whether to return multiple nodes, by default False

Returns:

The node that satisfies the condition

Return type:

Any

Submodules

account_codes_jp.cli module

account_codes_jp.cli.draw_networkx_labels_rotated(pos: Mapping[Any, Sequence[float]], labels: Mapping[Any, str], natural: bool = True, **kwargs: Any) None[source]

Draw networkx labels rotated.

Parameters:
  • pos (dict[Any, Sequence[float]]) – The positions of the nodes

  • labels (dict[Any, str]) – The labels of the nodes

  • natural (bool) – Whether to rotate the labels from left to right as much as possible, by default True

  • **kwargs (Any) – Additional keyword arguments to pass to plt.text

account_codes_jp.cli.export(path: Path | None = None, industry: Literal['一般商工業', '建設業', '銀行・信託業', '銀行・信託業(特定取引勘定設置銀行)', '建設保証業', '第一種金融商品取引業', '生命保険業', '損害保険業', '鉄道事業', '海運事業', '高速道路事業', '電気通信事業', '電気事業', 'ガス事業', '資産流動化業', '投資運用業', '投資業', '特定金融業', '社会医療法人', '学校法人', '商品先物取引業', 'リース事業', '投資信託受益証券'] | None = '一般商工業', type: Literal['edinet', 'blue-return'] = 'edinet', graphviz_layout: str = 'sfdp', graphviz_args: str = '') None[source]

Export accounts.

account_codes_jp.cli.list(type: Literal['edinet', 'blue-return'] = 'edinet', industry: Literal['一般商工業', '建設業', '銀行・信託業', '銀行・信託業(特定取引勘定設置銀行)', '建設保証業', '第一種金融商品取引業', '生命保険業', '損害保険業', '鉄道事業', '海運事業', '高速道路事業', '電気通信事業', '電気事業', 'ガス事業', '資産流動化業', '投資運用業', '投資業', '特定金融業', '社会医療法人', '学校法人', '商品先物取引業', 'リース事業', '投資信託受益証券'] | None = '一般商工業') None[source]

List accounts.