Skip to content

planets data class - ease of access #2

@astroDimitrios

Description

@astroDimitrios

planets.csv provides a useful dataset for learning/exploration.

I would like something class/dict based which is easier to access:

from astroedu.planets import earth
print(earth.r)
>>> 6371000
print(earth.units)
>>> r, Radius in m

Not sure about the units bit etc. Might just leave that for the docs.

I am thinking this could be coded straight into a .py file and then dumped into a .json.
The rest of the code would use the .py file and the .json could be backup/if people want it for other languages.

https://www.blog.pythonlibrary.org/2014/02/14/python-101-how-to-change-a-dict-into-a-class/
https://stackoverflow.com/questions/11821322/elegant-way-to-store-dictionary-permanently-with-python

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions