Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A script which gets specific properties for you #49

Merged
merged 3 commits into from
Jul 22, 2022

Conversation

OneByteGH
Copy link
Contributor

This script will ask you what properties you want and then it will generate a new JSON with just those properties (for every element)

Copy link
Owner

@Bowserinator Bowserinator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script assumes the windows path separator, you can use os to get the specific path separator for the user's os.

@OneByteGH
Copy link
Contributor Author

Fixed that + made it so it also exports to CSV.

Thank you, didn't expect a reply haha, this is my first open source contribution

@Bowserinator
Copy link
Owner

Ok I tested it, the UI is nice, but there are some errors:

1

        for key in data_needed:
            if data_needed[key]:
                e += element[key] + ','

This assumes element[key] is a string, if it's a number (or any non-string) the thing crashes. (You should cast it to str() first)

2

The CSV has trailing commas, as in there's an extra comma at the end:

Hydrogen,
Helium,

etc..., you can either strip the last comma or save all the properties as a list then use ",".join(properties)

Also the first row of the CSV should be the headers of the properties like in the CSV in the main repo

3

Consider using https://docs.python.org/3/library/argparse.html, so you can do stuff like

python specific_data.py --properties a,b,c, -o my_output.csv

That way the user can specify what they want as an argument directly instead pressing y/n many times. You can keep the current program under an interactive flag or something.

Also an option to specify file output location would be nice

@OneByteGH
Copy link
Contributor Author

Fixed and added all the stuff mentioned in the comment

@Bowserinator Bowserinator merged commit 9dbd4cb into Bowserinator:master Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants