Created
August 3, 2018 14:43
-
-
Save icshih/52ca49eb218a2d5b660ee4a653301b2b to your computer and use it in GitHub Desktop.
Read VOTable file and return a Pandas DataFrame object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Thanks, that's helpful. IMO, it would be nice if it were in the astropy library in the first place
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
This Python function reads the data from a VOTable file and returns a Pandas DataFrame object.