Data Manipulation

How to get the unique set of characters?

# The unique characters in the file
vocab = sorted(set(text))

Dealing with External Files

How to deal with zip files

import zipfile
zip_ref = zipfile.ZipFile(local_zip, 'r')
zip_ref.extractall('/tmp/horse_or_human')
zip_ref.close()

CSV

import csv
with open('names.csv', newline='') as csvfile:
    reader = csv.DictReader(csvfile)
    for row in reader:
        print(row['first_name'], row['last_name'])

Python Attrs

Documentation

Sphinx

Use the following syntax to make a doc

.. automodule:: package.module_name
.. autofunction:: function_name
.. autodata:: variable_name

:py:mod:`package.module_name`

Make a TOC

.. contents::
    :local:

How to use a cross reference


# Make a link
.. _link_name:

# Referencing
:ref:`link_name`

Random

How to generate a normal distribution o

  • numpy.random.normal.
  • scipy.stats.norm

    stats.norm.rvs(loc, scale, size, random_state)
    

Etc

Conda

Conda-forge is a community channel made up of thousands of contributors. Conda-forge itself is analogous to PyPI but with a unified, automated build infrastructure and more peer review of recipes.