1

Ok, so I have aggregated a bunch of data that looks like this:

      X-mean   y-Mean   z- Mean 

1     0.3444   2.34987   1.347
2      etc.
3
4
5
6

Except, it is not three columns, but 561 of them :-)

So, it seems like such a simple problem to me: I know how to plot the first column vs. the x column using Mean_f_values.plot(y= y_vals, use_index=True).So, the column names are often a bunch of gibberish, so I want to plot individual plots by not referring to their names, but just their location. I want to do some kind of for loop and display several graphs as I try to weed out useless columns. But all I can find (so far) is that we can only refer to column name, not their location when plotting. It seems obvious to me that this cannot be true, at least with some kind of simple plotting method. I am kinda noob, so what am I missing? Thanks!

user5179531
  • 221
  • 1
  • 2
  • 7
  • You can access by index location. `df.iloc[:,2:5]`, for example will give you all rows in columns 2,3,4 – G. Anderson Mar 12 '19 at 22:04
  • [Further Reading](https://stackoverflow.com/questions/31593201/how-are-iloc-ix-and-loc-different) for indexers, and the [documentation](https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html) from pandas – G. Anderson Mar 12 '19 at 22:07
  • This is indeed what I tried to do. I did {y_vals=Mean_f_values.iloc[:,2:5] Mean_f_values.plot(y= y_vals, use_index=True)} and the error is "ValueError: Must pass DataFrame with boolean values only." Could be something else is wrong. – user5179531 Mar 13 '19 at 00:26
  • If you're getting an error, please dit your question with the full traceback so we can give more specific help. See [mcve] for more information – G. Anderson Mar 13 '19 at 14:47

0 Answers0