Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Sliceable dictionary

Project description

Build Status Version Status Downloads

Dictionary that supports slices.

Slict implements Mapping and accepts the [start]:[stop] index to slice tuple-keys along one or more of their dimensions.

Slict can wrap any other Python Mapping and is lightweight (O(1) in space). Try it with a chest, for example.

Example

>>> from slict import Slict

>>> weather = Slict({("12pm", "Temperature"): 15.,  ("12pm", "Wind Speed"): 12.5,
...                  ("1pm",  "Temperature"): 15.5, ("1pm", "Wind Speed"):   9.2})

>>> temps = weather[:,"Temperature"]
>>> for k in temps:
...   print("The temperature at {:4s} is {:f}".format(k, temps[k]))
The temperature at 12pm is 15.000000
The temperature at 1pm  is 15.500000

>>> noon_weather = weather["12pm",:]
>>> for k in noon_weather:
...   print("The {:s} is {:f}".format(k, noon_weather[k]))
The Temperature is 15.000000
The Wind Speed is 12.500000

Install

slict is on the Python Package Index (PyPI):

pip install slict

Project details


Download files

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

Files for slict, version 0.2.5
Filename, size File type Python version Upload date Hashes
Filename, size slict-0.2.5.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page