Setting up Python in Windows 10

Installing Python under Windows 10 is fairly easy as long as you set up your system environment correctly. Below is my quick guide, which follows similar how-to’s I’ve written for installing Python under Windows 7 and under Windows 8.1.

Ready? Here’s your quick guide:

Set up Python on Windows 10

1. Visit the official Python download page and grab the Windows installer for the latest version of Python 3. A couple of notes:

  • Python is available in two versions — Python 2 and Python 3. For beginners, that may be confusing. In short, Python 3 is the current and future state of the language; Python 2 is a legacy version that still has a large base of users. Python 2 will reach its end of life in January 2020 and will only get bug fixes till then.
  • By default, the installer provides the 32-bit version. There’s also a 64-bit version available. I’ve generally stuck with 32-bit for compatibility issues with some older packages, but installing is so easy you can experiment with either.

2. Right-click on the installer and select “Run as Administrator.” You’ll have two options — choose “Customize Installation.”

3. On the next screen, check all boxes under “Optional Features.” Click next.
Continue…

Analyzing Shapefile Data with PostgreSQL

This is one in a series of posts adapted from material in the book Practical SQL.

Spend some time digging into geographic information systems (GIS) and soon enough you’ll encounter a shapefile. It’s a GIS file type developed by mapping software firm Esri for use in its popular ArcGIS platform. A shapefile contains the geometric information to describe a shape—a river, road, lake, or town boundary, for example—plus metadata about the shape, such as its name.

Because the shapefile has become a de facto standard for publishing GIS data, other applications and software libraries use shapefiles too, such as the open source QGIS.

While researching GIS topics for a chapter in my book, Practical SQL, I learned that it’s easy to import a shapefile into a PostGIS-enabled PostgreSQL database. The information that describes each shape is stored in a column of data type geometry, and so you can run spatial queries to calculate area, distances, intersections of objects, and more.

Here’s a quick exercise, adapted from the book. Continue…

DC PostgreSQL User Group, June 2018

Many thanks to Stephen Frost of Crunchy Data and Brad Sneade of LiveSafe for inviting me to speak about my book Practical SQL at the DC PostgreSQL User Group in early June! The night featured good food, fun conversations, and tales from me on how a journalist came to write a book about PostgreSQL and data analysis.

I shared tips I picked up along the way on using PostGIS, crosstabs, statistics functions, and Python within PostgreSQL—all topics I cover in the book.

The DC PostgreSQL Users Group features a warm, inviting atmosphere. Check out its Meetup page and consider stopping in if you’re in the region.

A few tweets from the evening:

Next time, I will bring a bigger screen …

‘Practical SQL’ Available in Bookstores!

I’m thrilled to say that Practical SQL: A Beginner’s Guide to Storytelling with Data is officially released today! The title is published by No Starch Press and distributed via Penguin Random House, which means you can find it wherever books are sold.

From the description:

Practical SQL is an approachable and fast-paced guide to SQL (Structured Query Language), the standard programming language for defining, organizing, and exploring data in relational databases. The book focuses on using SQL to find the story your data tells, with the popular open-source database PostgreSQL and the pgAdmin interface as its primary tools.

Practical SQL Anthony DeBarrosMuch of Practical SQL is based on the years I spent in newsrooms, including USA TODAY, poring over data sets in search of a story. SQL-driven databases were a central part of my toolkit, allowing me to organize, clean, and find meaning in data sets ranging from a handful of rows up to millions of records across dozens of tables. Today, the language is still widely used, powering thousands upon thousands of software applications.

Please check out the bundle from No Starch that includes a print copy plus ebook versions (PDF, .mobi, and .epub). No Starch Press is a thoughtful company that supports the open source software community, so you can feel good backing them. No Starch often runs promotions, so follow the company on Twitter or get their newsletter for deals.

Of course, you can also order the book through Amazon, and copies should be on shelves at Barnes & Noble or your favorite independent local bookstore.

In coming weeks, I’ll announce some special giveaways, sharing tips from the book, and booking some in-store appearances. Stay tuned.

‘Practical SQL’ Book in Early Release

My first book, Practical SQL: A Beginner’s Guide to Storytelling with Data, is out in early release from No Starch Press starting today! If you pre-order from No Starch, you can download the Introduction and first four chapters now. You’ll get additional chapters regularly until the final version comes out in February 2018.

Practical SQL is for people who encounter data in their everyday lives and want to know how to analyze or transform it. The book covers real-world data and scenarios, from analyzing U.S. Census demographics to the duration of taxi rides in New York City. I’ve aimed the exercises at beginning SQL coders, and all the code and data can be downloaded via No Starch’s site.

That database you’ll use is the free, open-source PostgreSQL, along with the pgAdmin 4 graphical user interface. We cover all the basics you’ll find in standard ANSI SQL along with PostgreSQL-specific features such as full text search and GIS.

More to come as additional chapters hit early release!