Python is a general purpose high-level language. I decided to learn it to augment R as it has excellent web-scraping tools, machine learning and even has a several web-development frameworks such as Django.

Topics

Packages

There are a lot of packages for Python, what you install will depend highly on what you wish to do. As I mainly do data science, statistics, automated reporting and attempt to do so in a computer science framework these are the packages that I use regularly.

My requirements.txt file can be found here. When creating a new virtual environment install all packages with…

snippet.bash
pip install -r requirements.txt

Packages can be given aliases when they are imported, some common packages have common abbreviations…

snippet.python
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

Upgrading

Pip doesn't have a flag to automatically upgrade everything (at least according to this thread) but a suggested solution is to…

snippet.bash
 ❱ pip list --outdated --format=json | jq -r '.[] | .name'  | xargs -n1 pip install -U

Tips and Tricks

Fun

Packages Specific Pages

Standard Library

Data Management

Graphics

  • altair a grammar of graphics like declarative plotting package in Python.
  • bokeh for interactive plots (zooming etc.)
  • cufflinks for adding sparkle to Plotly graphs.
  • folium for embedding maps.
  • Matplotlib base plotting.
  • Plotly Making graphs fancy interactive graphs.
  • plotnine a grammar of graphics for Python (viz. ggplot2 for Python)
  • Seaborn preconfigured plots/themes for matplotlib

GIS

Jupyter

Statistics

Testing and Linting

Reporting

  • Codebraid Pandoc Markdown reports.
  • Pweave Python equivalent of RMarkdown for producing slides/PDF/HTML output from Markdown with embedded code chunks.

HTML

  • Pelican static website generator that parses Markdown.

My projects

Bandcamp Library

I decided to write a library/program for managing Bandcamp.

tpx2gpx

I needed to convert GPS traces recorded by Endonmondo which exports as Garmin TPX files to the more generic GPX format for importing into OpenTrack (I'd decided I wanted more privacy whilst recording my running and cycling). I therefore wrote tpx2gpx to do this and took the opportunity to learn a bit about CD/CI (Continuous Development/Continuous Integration) on GitLab and how to release packages to PyPi.

Weston Park Weather

Scraping data on weather from @WPWeather a weather station in Weston Park, Sheffield.

AirQuality

I have an Air Quality monitor outside of my house and wanted to play around with the data myself, to which end I started (but haven't yet finished) writing a package to grab the data from Luftdaten and store it in a MongoDB in their Atlas Cloud service.

Links

Numpy

Statistics

Learning

Kids

Books

Podcasts

Blog Articles

Software Development

Deployment

Programming

Refactoring

SOLID

Statistics

History

python/python.txt · Last modified: 2023/07/27 10:10 by admin
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0