thedansimonson/ft
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
# ft lib
This is a library for manipulating lists of dictionaries.
## Setup
You can get the stable version using pip:
$ pip install ft
## Running Tests
If you're having trouble running tests, run them from the ft repo root
directory, and do the following:
$ export PYTHONPATH=`pwd`
$ python tests/test_name.py
## Conventions
data: If an argument is called data, a list of dictionaries is expected there.
datum/point: A single dictionary in a list of dictionaries.
dex: If an argument is called dex, then it should be a dex--a dictionary
whose values are lists of dictionaries. This is what indexBy returns.
prop: If an argument is called prop, it's a property. This usually should
be an entry in every datum in data. It isn't always, sometimes intended for
retaining consistency.
## Official To-Do/Bugs List
### Bugs:
+ load_csv is a half-baked implementation. No quote support.
### To-Do/Ideas (No Particular Order):
* multidex seems to be superslow--optimizations required.
* validate
* a version of validate that doesn't raise an error, but instead
just returns naughty and nice lists.
* fill_defaults
- given a default entry, it fills each data point that lacks
a key in default with the kv pair in the default.
* dump_csv
- both load_csv and dump_csv need to be totally written to handle
dialects more formally
* load_json, dump_json - I don't use json enough for this, but it's easy.
* indexBy4's performance really dragged once pipe was fixed. Further
optimizations: change pipe's default from lambda x: x to False and
create two cases.
* mv(("x","y"), [{"x":...}, ...]) -> [{"y":...}, ...]
* has - remove values that don't have property
* fulldex: build a dex of every value available. crazy? absolutely.
* kmap(data, k, f)
d[k] = f(d[k])
* tag is so useful, but it's hideous. why is it so wrong?
- too expressive, perhaps