Skip to content

Commit 4a30452

Browse files
simpler json parse code in api
1 parent a7b38fa commit 4a30452

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

source/reading.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,8 +1520,9 @@ data_dict = {
15201520
}
15211521
15221522
for item in nasa_data:
1523-
data_dict["copyright"].append(item["copyright"] if "copyright" in item else None)
1524-
for entry in ["url", "title", "date"]:
1523+
if "copyright" not in item:
1524+
item["copyright"] = None
1525+
for entry in ["url", "title", "date", "copyright"]:
15251526
data_dict[entry].append(item[entry])
15261527
15271528
nasa_df = pd.DataFrame(data_dict)

0 commit comments

Comments
 (0)