Some simple tools for working with parsed Sensospot data.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Holger Frey e52ed8c2b6 removed separate flake8 config 2 years ago
src/sensospot_tools updated readme 2 years ago
tests added functions for selecting from dataframes and splitting a dataframe 2 years ago
.gitignore import of project template 2 years ago
.pre-commit-config.yaml removed separate flake8 config 2 years ago
CHANGES.md import of project template 2 years ago
CONTRIBUTING.md import of project template 2 years ago
LICENSE import of project template 2 years ago
Makefile updated readme 2 years ago
README.md updated readme 2 years ago
pyproject.toml added functions for selecting from dataframes and splitting a dataframe 2 years ago
tox.ini import of project template 2 years ago

README.md

Sensospot Tools

Some small tools for working with parsed Sensospot data.

Selecting and spliting a pandas data frame

sensospot_tools.select(data: DataFrame, column: str, value: Any) -> DataFrame

Selects rows of a dataframe based on a value in a column

Example:


    from sensospot_tools import select

    print(data)
        category  value
    0      dog      1
    1      cat      2
    2    horse      3
    3      cat      4

    print(select(data, "category", "cat"))
          category  value
        1      cat      2
        3      cat      4

sensospot_tools.split(data: DataFrame, column: str) -> Iterator[tuple[Any, DataFrame]]

Splits a data frame on unique values in a column

Returns an iterator where each result is key-value-pair. The key is the unique value used for the split, the value is a slice of the dataframe selected by the unique value contained in the column.

Example:


    from sensospot_tools import split

    print(data)
        category  value
    0      dog      1
    1      cat      2
    2    horse      3
    3      cat      4

    result = dict( split(data, column="category") )

    print(result["dog"])
        category  value
    0      dog      1

    print(result["cat"])
        category  value
    1      cat      2
    3      cat      4

    print(result["horse"])
        category  value
    2    horse      3

Development

To install the development version of Sensospot Tools:

git clone https://git.cpi.imtek.uni-freiburg.de/holgi/sensospot_tools.git

# create a virtual environment and install all required dev dependencies
cd sensospot_tools
make devenv

To run the tests, use make tests or make coverage for a complete report.