Skip to main content

Convenient functions and classes I use too often.

Project description

My Favorite Things

Convenient functions and classes I use too often. If Coltrane was a programmer (shudder) and much worse.

Installation

Install with

pip install my-favorite-things

Current Methods

save

save()

Import by

from my_favorite_things import save

This method is used for saving data to a file. You can save as an .npz file for numpy array(s) or as a .pkl file for dictionaries and other odd python objects. By default, it will not overwrite existing files but instead append a number onto the end of file name (the keywords being, by default, overwite=False and append=True). You can save relative to your current directory (absolute=False) or as an absolute path (absolute=True). Addtionally, double check that you're saving to the correct directory with dryrun=True. Check the doc string for more info.


ddict

nested_ddict()

Import by

from my_favorite_things import nested_ddict

This method allows for creating a nested defaultdictionary. This is useful if you have data that is dependent on multiple parameters that are heirarchical. For example, if we do

d = nested_ddict(3, list)

then we can use it as

d['zero']['one']['two']['three'].append(datum)

format_ddict()

Import by

from my_favorite_things import format_ddict

This method will format your (nested) defaultdictionary into dictionaries. Additionally, it can turns lists in numpy arrays and/or sort the lists too.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

my-favorite-things-0.2.0.tar.gz (42.0 kB view hashes)

Uploaded Source

Built Distribution

my_favorite_things-0.2.0-py3-none-any.whl (30.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page