Skip to content

Instantly share code, notes, and snippets.

@icshih
Created August 3, 2018 14:43
Show Gist options
  • Save icshih/52ca49eb218a2d5b660ee4a653301b2b to your computer and use it in GitHub Desktop.
Save icshih/52ca49eb218a2d5b660ee4a653301b2b to your computer and use it in GitHub Desktop.
Read VOTable file and return a Pandas DataFrame object
from astropy.io.votable import parse
import pandas as pd
def votable_to_pandas(votable_file):
votable = parse(votable_file)
table = votable.get_first_table().to_table(use_names_over_ids=True)
return table.to_pandas()
@icshih
Copy link
Author

icshih commented Aug 3, 2018

This Python function reads the data from a VOTable file and returns a Pandas DataFrame object.

@StKyr
Copy link

StKyr commented Feb 16, 2020

Thanks, that's helpful. IMO, it would be nice if it were in the astropy library in the first place

@icshih
Copy link
Author

icshih commented Feb 20, 2020

You are welcome, and I'm happy my code helps. BTW, I'm surprised that astropy still doesn't provide a similar function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment