import pandas as pd
import numpy as np
from abc import ABC, abstractmethod
from typing import Optional

class DataExporter(ABC):
    """数据导出器基类"""
    @abstractmethod
    def export(self, data: np.ndarray, filepath: str, **kwargs):
        pass

class CSVExporter(DataExporter):
    """将数据导出为 CSV 文件"""
    def export(self, data: np.ndarray, filepath: str, **kwargs):
        """
        将 numpy 数组保存为 CSV 文件。
        kwargs 可传递给 pandas DataFrame.to_csv，如 index=False。
        """
        df = pd.DataFrame(data)
        df.to_csv(filepath, **kwargs)