May-07-2022, 02:25 AM
I have worked through 300+ pages of Shovic & Simpson's Python for Dummies All in One but hit a snag in Book 3, Chapter 2.
The first issue is that the book first discusses converting CSV files to JSON using www.convertcsv.com/csv-to-json. This works well, but the results I get don't match the book in that the dates come through as strings like
The next issue in this chapter relates to getting JSON data from Google's Firebase Realtime Database that has these automatically added keys, "Those weird things like -LAOqOxg6kmP4jhnjQXS are all keys that the Firebase generates automatically for each item of data to guarantee uniqueness."
But, when I take JSON data that I've converted from a CVS file and load it into Firebase, I don't get automatically generated keys for each dictionary (or JSON object).
These problems recur when trying to convert "an Excel date to a JSON date" in that the dates that I have are pre-converted, as well as when "Looping through a keyed JSON file"...because the JSON file doesn't have any of the keys mentioned above.
I'd like to finish the chapter, but it seems this has become a road-block due to my lack of understanding.
Thanks for any illumination.
The first issue is that the book first discusses converting CSV files to JSON using www.convertcsv.com/csv-to-json. This works well, but the results I get don't match the book in that the dates come through as strings like
Output:"DateJoined": "2/3/2017"
instead of the serialized dates the book showsOutput:"Date Joined": 37683
The next issue may be related to the first, in that the book talks about converting JSON dates (which it implies are always the serialized kind) to Python dates (with human-readable formatting) and that to do that you add this:import xlrdbut my Python (from Anaconda3 controlled by VBS) rejects the xlrd module line:
Output:ModuleNotFoundError: No module named 'xlrd'
which doesn't seem to matter as the JSON date from the conversion wasn't serialized to begin with.The next issue in this chapter relates to getting JSON data from Google's Firebase Realtime Database that has these automatically added keys, "Those weird things like -LAOqOxg6kmP4jhnjQXS are all keys that the Firebase generates automatically for each item of data to guarantee uniqueness."
But, when I take JSON data that I've converted from a CVS file and load it into Firebase, I don't get automatically generated keys for each dictionary (or JSON object).
These problems recur when trying to convert "an Excel date to a JSON date" in that the dates that I have are pre-converted, as well as when "Looping through a keyed JSON file"...because the JSON file doesn't have any of the keys mentioned above.
I'd like to finish the chapter, but it seems this has become a road-block due to my lack of understanding.
Thanks for any illumination.