japan fiscal year

japan fiscal year(日本の会計年度)について

タグ 日本の会計年度 fiscal year Google Play Store


会計年度

  • 4月1日から翌年3月31日までの期間

時間データのfiscal yearへの変換方法

import pandas as pd

# サンプルのGoogle Play Storeデータセットを読み込み
url = "https://raw.githubusercontent.com/enjoykcc456/google-playstore-analysis/main/googleplaystore.csv"
df = pd.read_csv(url)

df['Last Updated'] = pd.to_datetime(df['Last Updated'], errors='coerce')

# 日本の年度を計算する関数を定義
def get_japan_fiscal_year(date):
    if pd.isnull(date):
        return None
    year = date.year
    if date.month < 4:
        return year - 1
    else:
        return year

# 日本の年度列を追加
df['japan_fiscal_year'] = df['Last Updated'].apply(get_japan_fiscal_year)

# 結果を表示
display(df[['App', 'Last Updated', 'japan_fiscal_year']])