-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Hello,
I'm working on a library which makes the use of tabular data pretty easy, no matter the format: CSV, XLS, XLSX, HTML etc. It's called rows.
I think it would be great to add a section with examples using this kind of library, since the learner can access data with simple commands and don't need to understand about the format upfront.
An example: reading the CSV file from coding-for-journalists/2_web_scrape/completed/fun_with_csv_done.py with rows is as easy as:
import rows
for row in rows.import_from_csv('my_test.csv'):
print row.FIRSTNAME, row.CITYIf the same was only available on XLS, you could use this code:
import rows
for row in rows.import_from_xls('my_test.xls'):
print row.FIRSTNAME, row.CITYSo the interface is the same, no matter the format. I think it helps who is learning the basics -- then, they can dig deeper and learn more about each specific format.
Note:
rowswill automatically identify and convert the data (in this case there are just strings, but it will convert automatically toint,float,datetime.date,datetime.datetime, among other types if it detects there is information of this kind inside the file -- and this is true for all formats available), so you don't need to explain data conversion upfront but can actually show some examples of converted data being analyzed which is very motivational.