1

I am struggling to find a function in IDL that will replicate something I have done in Python with Pandas. I am new to IDL and there is next to nothing resource wise that I can find.

In Python, I use the following:

pd.read_csv('<csv filepath>', usecols=[n])

The usecols part will only pull in the columns of a CSV I would like in my data frame. Is there a way to do this in IDL?

I hope this makes sense - my first post here!

Thanks.

mgalloy
  • 2,356
  • 1
  • 12
  • 10
Fishbones78
  • 61
  • 11

1 Answers1

1

There is a READ_CSV routine that can read CSV files, but it does not have a way to pull out specific columns. It will give you a structure with one field for each column of the CSV file — so you could just grab the column you need from the structure and throwing away the rest of the structure. Something like:

csv = read_csv('somefile.csv')
col_n = csv.(n)
mgalloy
  • 2,356
  • 1
  • 12
  • 10
  • I hadn't realised that IDL made a structure of individual, separated columns like it does until this morning. I was also unaware I could use csv.(n). Very helpful, thank you! – Fishbones78 Oct 04 '18 at 14:59