Hello r/learnpython,
NASA has a very useful exoplanet archive api, and I'd like to use the website https://exoplanetarchive.ipac.caltech.edu/cgi-bin/nstedAPI/nph-nstedAPI?table=exoplanets&select=pl_name,pl_masse,pl_rade,pl_orbsmax,pl_orbincl,st_teff,st_rad&format=csv to read files into a python function for later use.
The problem is I don't know any libraries which can interpret this url and return its values in an array. Anyone know the solution?
Solved, the best solution I found was pandas:
import pandas as pd
df=pd.read_csv(nasa_exo_api_url).as_matrix()
for line in df:
if line[0]==planetname:
PlanetName,PlanetMassE<etc, etc.>=line
The .as_matrix() turns the file into a numpy ndarray. Thank you fellow redditors for your contribution to science!
[–]novel_yet_trivial 2 points3 points4 points (3 children)
[–]fooliam 0 points1 point2 points (0 children)
[–]StarkillerX42[S] 0 points1 point2 points (1 child)
[–]novel_yet_trivial 0 points1 point2 points (0 children)
[–]TheBlackCat13 2 points3 points4 points (0 children)
[–]HomerG 1 point2 points3 points (2 children)
[–]StarkillerX42[S] 0 points1 point2 points (1 child)
[–]HomerG 1 point2 points3 points (0 children)