The issue arises because the CSV file contains metadata lines before the actual header row, which prevents pandas.read_csv()
from interpreting the columns as numeric. By using header=3
, we can skip the metadata and correctly parse the data. However, to preserve the metadata in the DataFrame, convert only the rows below the metadata using pd.to_numeric(df[col][3:])
. This ensures numeric data is treated correctly while keeping the metadata intact for further use or export.