[Python] How do I save two arrays as a text file with tab as a column delimiter?

Discussão em 'Python' iniciado por Stack, Abril 8, 2025.

  1. Stack

    Stack Membro Participativo

    I have two numpy arrays. Array1 contains the wavelength value and array2 contains the flux value.

    array1=[5625.04152255 5625.11815852 5625.19478889 ... 6020.79150447 6020.86486562
    6020.93822138]
    array2=[0.93763397 0.89685317 0.9532884 ... 1.0172066 0.9948189 1.00680107]


    The first wavelength in array1 has the first flux of array2 as its pair and I want to save them as a text file with the first line being the header names 'wavelength' and 'flux'

    wavelength flux
    5625.04152255 0.93763397
    5625.11815852 0.89685317
    5625.19478889 0.9532884

    Continue reading...

Compartilhe esta Página