How do I find an Index of a header in a csv file in Python?
<p>My program list the headers of a CSV file to a user and asks him to pick an x and an y to plot. It works fine, but I don't want the user to type out the header string. I would rather find the index of each of the header and ask him to type a number instead. My csv file looks as follows:</p>

<pre><code>time(s),speed(m/s),alt_a(m),....
25,62,10
45,70,20
30,50,30
</code></pre>

<p>Currently, the user has to type out for x, speed(m/s) I would rather the data shows up something like this and have the user just type 2.</p>

<pre><code>1.time(s),2.speed(m/s),3.alt_a(m)
</code></pre>

<p>I looked a lot during the past two days and I can't seem to find any information of how would I even begin to do this.</p>

<pre><code>import pandas as pd

df = pd.DataFrame.from_csv('data.csv',index_col=False)

while True:
    print (list(df))
    print ('Select X-Axis')
    xaxis = input()
    print ('Select Y-Axis')
    yaxis = input()
    break

df.plot(x= xaxis, y= yaxis1)
</code></pre>