Graphics Programs Reference
In-Depth Information
code to get the job done. With code you become much more flexible, and
you can tailor your scripts specifically for your data.
Now jump right into an example on how to easily switch between data for-
mats with just a few lines of code.
ExAMPLE: SWITCh bETWEEN DATA ForMATS
This example uses Python, but you can of course use any language you
want. The logic is the same, but the syntax will be different. (I like to
develop applications in Python, so managing raw data with Python fits into
my workflow.)
Going back to the previous example on scraping data, use the resulting
wunder-data.txt file, which has dates and temperatures in Buffalo, New
York, for 2009. The first rows look like this:
20090101,26
20090102,34
20090103,27
20090104,34
20090105,34
20090106,31
20090107,35
20090108,30
20090109,25
...
This is a CSV file, but say you want the data as XML in the following format:
<weather_data>
<observation>
<date>20090101</date>
<max_temperature>26</max_temperature>
</observation>
<observation>
<date>20090102</date>
<max_temperature>34</max_temperature>
</observation>
<observation>
<date>20090103</date>
<max_temperature>27</max_temperature>
</observation>
<observation>
Search WWH ::




Custom Search