0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Pythonで2026年の世界のロケット打ち上げデータを可視化してみた

0
Posted at

はじめに

2026年、世界のロケット打ち上げが過去最多ペースで推移しています。SpaceXだけで累計656回、成功率97.7%。Starlink衛星は推定7,783基が稼働中で、もはや「宇宙は日常」になりつつあります。

エンジニアとしてこの数字を眺めていたら、自分でデータを触って可視化したくなりました。本記事では、公開されているロケット打ち上げデータをPythonで取得・加工・可視化するまでの流れを紹介します。

対象読者: Pythonの基本がわかる方。pandas/matplotlibの経験があるとスムーズです。

使用する環境

Python 3.11+
pandas 2.2+
matplotlib 3.9+
requests 2.32+
pip install pandas matplotlib requests

1. データ取得

ロケット打ち上げのオープンデータベースから、JSON形式でデータを取得します。世界中の打ち上げ情報を網羅した公開データソースがいくつか存在するので、お好みのものを使ってください。

import requests
import pandas as pd
import matplotlib.pyplot as plt
from datetime import datetime

# お好みの公開データソースに置き換えてください
API_URL = "https://your-data-source.example.com/launches"

def fetch_launches(limit=300):
    """打ち上げデータを取得"""
    params = {
        "limit": limit,
        "ordering": "-net",  # 日付降順
    }
    all_launches = []
    url = API_URL

    while url and len(all_launches) < limit:
        resp = requests.get(url, params=params)
        resp.raise_for_status()
        data = resp.json()

        results = data.get("results", data) if isinstance(data, dict) else data
        all_launches.extend(results)

        # ページネーション対応
        url = data.get("next") if isinstance(data, dict) else None
        params = {}  # nextURLにはパラメータが含まれている

    return all_launches[:limit]

launches_raw = fetch_launches(limit=300)
print(f"取得件数: {len(launches_raw)}")

Note: 多くの公開データベースはレートリミットがあります。短時間に大量リクエストを送らないよう注意してください。

2. データの前処理

取得したJSONをpandas DataFrameに変換し、分析しやすい形に整えます。

def preprocess(raw_data):
    """生データをDataFrameに変換・クリーニング"""
    records = []
    for launch in raw_data:
        # データソースによってフィールド名が異なる場合があるので適宜調整
        record = {
            "name": launch.get("name", "Unknown"),
            "date": launch.get("net") or launch.get("date") or launch.get("launch_date"),
            "status": launch.get("status", {}).get("abbrev", "Unknown")
                      if isinstance(launch.get("status"), dict)
                      else launch.get("status", "Unknown"),
            "provider": launch.get("launch_service_provider", {}).get("name", "Unknown")
                        if isinstance(launch.get("launch_service_provider"), dict)
                        else "Unknown",
            "rocket": launch.get("rocket", {}).get("configuration", {}).get("name", "Unknown")
                      if isinstance(launch.get("rocket"), dict)
                      else launch.get("rocket", "Unknown"),
            "country": launch.get("pad", {}).get("country_code", "Unknown")
                       if isinstance(launch.get("pad"), dict)
                       else "Unknown",
        }
        records.append(record)

    df = pd.DataFrame(records)

    # 日付パース
    df["date"] = pd.to_datetime(df["date"], utc=True, errors="coerce")
    df["year"] = df["date"].dt.year
    df["month"] = df["date"].dt.month
    df["year_month"] = df["date"].dt.to_period("M")

    # 成功/失敗の分類
    success_keywords = ["Success", "Go"]
    df["is_success"] = df["status"].apply(
        lambda s: any(kw.lower() in str(s).lower() for kw in success_keywords)
    )

    return df

df = preprocess(launches_raw)
print(df.info())
print(df.head())

前処理のポイント:

  • 日付は pd.to_datetime でUTC統一。タイムゾーンが混在すると集計がずれます
  • ステータスはデータソースによって表記が異なるので、キーワードマッチで正規化
  • year_month 列を作っておくと月別集計が楽

3. 可視化1: 月別打ち上げ回数の推移

まずは最もシンプルな棒グラフから。

def plot_monthly_launches(df, year=2026):
    """月別打ち上げ回数"""
    df_year = df[df["year"] == year].copy()
    monthly = df_year.groupby("month").size()

    fig, ax = plt.subplots(figsize=(10, 5))
    colors = ["#1a73e8" if m <= datetime.now().month else "#ccc" for m in monthly.index]
    ax.bar(monthly.index, monthly.values, color=colors, edgecolor="white")

    ax.set_xlabel("", fontsize=12)
    ax.set_ylabel("打ち上げ回数", fontsize=12)
    ax.set_title(f"{year}年 月別ロケット打ち上げ回数", fontsize=14, fontweight="bold")
    ax.set_xticks(range(1, 13))
    ax.set_xticklabels([f"{m}" for m in range(1, 13)])

    # 平均線
    avg = monthly.mean()
    ax.axhline(y=avg, color="#e53935", linestyle="--", alpha=0.7, label=f"月平均: {avg:.1f}")
    ax.legend()

    plt.tight_layout()
    plt.savefig("monthly_launches.png", dpi=150, bbox_inches="tight")
    plt.show()

plot_monthly_launches(df)

出力例: 1〜3月で既に高い水準。SpaceXのFalcon 9が週2〜3回ペースで飛んでいるのが大きい。

4. 可視化2: 企業別の打ち上げ数ランキング

def plot_provider_ranking(df, top_n=10):
    """企業別打ち上げ数の横棒グラフ"""
    provider_counts = df["provider"].value_counts().head(top_n)

    fig, ax = plt.subplots(figsize=(10, 6))
    colors = ["#1a73e8" if i == 0 else "#42a5f5" for i in range(len(provider_counts))]
    bars = ax.barh(
        provider_counts.index[::-1],
        provider_counts.values[::-1],
        color=colors[::-1],
        edgecolor="white",
    )

    # 値ラベル
    for bar in bars:
        width = bar.get_width()
        ax.text(width + 1, bar.get_y() + bar.get_height() / 2,
                f"{int(width)}", va="center", fontsize=10)

    ax.set_xlabel("打ち上げ回数", fontsize=12)
    ax.set_title("企業別ロケット打ち上げ数 TOP10", fontsize=14, fontweight="bold")
    plt.tight_layout()
    plt.savefig("provider_ranking.png", dpi=150, bbox_inches="tight")
    plt.show()

plot_provider_ranking(df)

出力例: SpaceXが圧倒的1位。中国のCASCが2位、Rocket Labが3位あたり。

5. 可視化3: 成功率の推移

SpaceXの成功率97.7%という数字、実際に可視化すると際立ちます。

def plot_success_rate(df, providers=None):
    """企業別成功率の推移(年単位)"""
    if providers is None:
        providers = ["SpaceX", "CASC", "Roscosmos", "Rocket Lab", "ISRO"]

    fig, ax = plt.subplots(figsize=(10, 5))

    for provider in providers:
        df_p = df[df["provider"].str.contains(provider, case=False, na=False)]
        yearly = df_p.groupby("year").agg(
            total=("is_success", "count"),
            success=("is_success", "sum"),
        )
        yearly["rate"] = (yearly["success"] / yearly["total"] * 100).round(1)
        yearly = yearly[yearly["total"] >= 3]  # サンプル少なすぎるものは除外

        if not yearly.empty:
            ax.plot(yearly.index, yearly["rate"], marker="o", label=provider, linewidth=2)

    ax.set_xlabel("", fontsize=12)
    ax.set_ylabel("成功率 (%)", fontsize=12)
    ax.set_title("主要企業のロケット打ち上げ成功率推移", fontsize=14, fontweight="bold")
    ax.set_ylim(70, 102)
    ax.legend(loc="lower right")
    ax.grid(axis="y", alpha=0.3)

    plt.tight_layout()
    plt.savefig("success_rate.png", dpi=150, bbox_inches="tight")
    plt.show()

plot_success_rate(df)

出力例: SpaceXは2024年以降ほぼ100%に張り付き。Falcon 9の信頼性は驚異的。

6. 可視化4: ロケット再使用回数トップ10

Falcon 9のブースター再使用が当たり前になった2026年。どのブースターが最も多く飛んでいるかを見てみます。

def plot_reuse_ranking(df, top_n=10):
    """ロケット(機体名)別の打ち上げ回数"""
    # Falcon 9のブースター番号を抽出(名前に含まれる場合)
    falcon9 = df[df["rocket"].str.contains("Falcon 9", case=False, na=False)]

    # ブースター番号を名前から推定(データソースによる)
    rocket_counts = falcon9["name"].value_counts().head(top_n)

    # ロケット種別での集計にフォールバック
    if len(rocket_counts) < 3:
        rocket_counts = df["rocket"].value_counts().head(top_n)

    fig, ax = plt.subplots(figsize=(10, 6))
    colors = plt.cm.Blues(
        [0.3 + 0.7 * i / len(rocket_counts) for i in range(len(rocket_counts))]
    )
    ax.barh(
        rocket_counts.index[::-1],
        rocket_counts.values[::-1],
        color=colors[::-1],
        edgecolor="white",
    )
    ax.set_xlabel("打ち上げ回数", fontsize=12)
    ax.set_title("ロケット別 打ち上げ回数 TOP10", fontsize=14, fontweight="bold")

    plt.tight_layout()
    plt.savefig("reuse_ranking.png", dpi=150, bbox_inches="tight")
    plt.show()

plot_reuse_ranking(df)

出力例: Falcon 9が圧倒的。1基のブースターが20回以上飛ぶ時代。

7. 考察: 2026年のトレンド

データから読み取れるポイントを3つ。

再使用ロケット競争が本格化

SpaceXのFalcon 9は再使用の実績を積み重ね、累計656回・成功率97.7%という数字を叩き出しています。Starlink衛星の打ち上げだけで376回。推定7,783基が軌道上で稼働中です。

一方、Rocket LabのElectronやBlue OriginのNew Glennなど、再使用に挑戦する企業が増えてきました。「使い捨てロケット」は徐々にレガシーになりつつあります。

Starshipの存在感

SpaceXのStarshipは、完全再使用を目指す超大型ロケット。2026年の試験飛行の結果次第で、宇宙輸送のコスト構造が根本から変わる可能性があります。データとして追いかけるのが楽しいフェーズです。

新興国の参入

インド(ISRO)、韓国(KARI)、日本(JAXA/民間)など、アジア勢の打ち上げ頻度が上がっています。国別データを可視化すると、「米中二強+追う新興勢力」という構図が見えてきます。

まとめ

Pythonとpandas/matplotlibで、ロケット打ち上げデータを4パターン可視化しました。

可視化 わかること
月別打ち上げ数 2026年は過去最多ペース
企業別ランキング SpaceX一強、中国が追う
成功率推移 Falcon 9の信頼性は異常
再使用回数 1基で20回超えの時代

公開データを使えば誰でも同じ分析ができるので、ぜひ自分の手で触ってみてください。
コードをJupyter Notebookに貼り付ければ、そのまま動きます(APIのURLだけ差し替えてください)。

リアルタイムで更新されるダッシュボードに興味がある方は、以下も参考にどうぞ。

宇宙データ、眺めてるだけで楽しいですよね。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?