forked from chesterhow/tale
-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Datasette-lite this... #11
Comments
Related to: nasawakeupcalls/nasawakeupcalls.data#25 |
CSV quoting code: """Simple script to force-quote an existing CSV file as Sheets, and
Excel doesn't already do this. LibreOffice I believe does.
"""
import csv
data = []
header = None
with open("nasawakeupcalls.csv", "r", encoding="utf8") as nasa_csv:
csv_reader = csv.reader(nasa_csv, delimiter=",")
header = next(csv_reader, None)
# The remainder of the rows are data rows.
for row in csv_reader:
assert len(row) == len(
header
), "Problem parsing rows, inequal lenghts: {} (header) vs. {} (row)".format(
len(row), len(header)
)
data_dict = dict(zip(header, row))
data.append(data_dict)
with open("quoted_nasawakeupcalls.csv", "wt", newline="") as new_csv:
writer = csv.DictWriter(
new_csv, fieldnames=header, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL
)
writer.writeheader()
for idx, row in enumerate(data):
if not row:
continue
writer.writerow(row) |
Useful tool from SimonW:
|
Deployed to: https://nasawakeupcalls.github.io/datasette |
Linked to here as well: https://nasawakeupcalls.github.io/data/ Okay, I think this is done for now. We may look at datasette and think we can do more with the field types, and datasette may include more plugins as well. These can be registered as new issues. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have been working with Datasette-lite this week, and I would be exceptionally easy to convert this data to Datasette. (Actually it may simply just work from the CSV...) 🤔
The text was updated successfully, but these errors were encountered: