getting a lot of asteroids - maybe 100, maybe all of them - rather than a few specific ones, without being a Pandas guru #840
Replies: 2 comments
-
Whenever I need to remember how to iterate over dataframe rows, I read back through the answers to this Stack Overflow question—see if they work for you too: https://stackoverflow.com/questions/16476924/how-to-iterate-over-rows-in-a-dataframe-in-pandas |
Beta Was this translation helpful? Give feedback.
-
Yes, this works! I'm not sure it will be fast when there's a million asteroids in my "excerpt" table, there's some warning: Though iterating row-by-row is not especially efficient since Series objects have to be created. but I'll do some more testing and reading, then I'll finish up and write an answer to that Stack Exchange question and mark your reply as an answer. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Goal is to post a script that answers https://space.stackexchange.com/questions/57469/positions-of-asteroids-in-heliocentric-ecliptic-x-y-z-coordinates
To start of slow, this script should give me the first 100 asteroids as an excerpt. Note, I only know python, not good with command line nor Pandas
After downloading text file from https://www.minorplanetcenter.net/ I run this:
The first four lines look the same as the four lines generated by running
mpc_make_excerpt.py
and thenpython mpc_make_excerpt.py 00001 00002 00003 00004 > MPCORB.excerpt.DAT
in the documentation , but this way I can still get a million if I want.
Then I tried to make a list of asteroid objects in the excerpt using
for row in minor_planets.items():
because I don't know how to use Pandas, but that fails:The error message is:
Beta Was this translation helpful? Give feedback.
All reactions