Graphics Reference
In-Depth Information
Getting Started
To use Python, you must first download a recent version from
Python.org
.
It's also handy to have a nice text editor that provides syntax highlighting.
One of this topic's authors uses Programmer's Notepad
(
www.pnotepad.org/
)
, whereas the other uses Sublime Text
(
www.sublimetext.com
)
.
The emphasis in this topic is not on the basics of programming Python.
If you are already familiar with programming, you may find all you need
is a Python 3 cheat sheet (such as
www.cogsci.rpi.edu/~destem/gamedev/
mementopython3-english.pdf
). Be aware that the biggest quirk in Python
is that indentation matters in loops and
if
statements. Many other useful
books, websites, and programming resources are available for Python,
including the following:
•
Python.org
online documentation (
https://docs.python.org/3/
)
•
Beginning Programming with Python for Dummies
(Indianapolis:
Wiley, 2014)
If you get stuck at some point, likely your question has already been
answered
on
a
programming
Q&A
website
such
as
Cleaning Data
Many data sources can be messy. Python is a good tool for data cleansing
and preparation. Perhaps long labels must be shortened, or accents must
be removed because your graph software cannot handle them. Consider the
following example of data that must be cleaned:
From, To, CC, Date, Size
"Joé", "Zoë", "Timothy", 12/09/2014, 156kb
"Joé", "Ben", "SMTP:Ann@mail.co; Timothy; Zoë", 11/09/
2014, 2048kb
"Joé", "Timothy", "Ben; Zoë", 11/09/2014, 805kb
"Joé", , "Ben", 11/01/2014, 22kb