Skip to main content

It will do array manipulations functions like Searching, Sorting, Sorting, Min/Max value.

Project description

mds_array_manipulation

Documentation Status ci-cd release version License: MIT License: CC BY-SA 4.0 Python 3.9.0

Summary

Project Summary

The package is intended to do basic array manipulations functions like Searching, Sorting, Counting non-zero elements, Finding indices of max value. This is a package developed for the group-17 project for the UBC MDS DSCI 524 (Collaborative Software Development) course. Documentation can be found here.

The package has been published on the pypi website and you can find it here.

Functions Included in the Package

  • sort_array: Takes a numpy array of integers or strings and returns the array in sorted order, using Insertion Sort (Sedgewick, 1983).

  • search_array: Searches for and returns the index of a specified element in a numpy array, if it exists

  • count_nonzero_elements: Count the number of non zero elements in an array

  • argmax: Returns the index of the max element in the array

Fit into the Python Ecosystem

There are several Python packages focused on array manipulation, such as numpy, which have extensive features. This package aims to recreate some of the basic array operations available in the numpy package (Numpy Developers, 2008-2024) for use in Data Science preprocessing workflows. The package is intended to focus only on the basic operations to make Data science worflows easier to understand and use for beginner programmers.

Installation

Installation can be done from pypi using the following command

pip install mds_array_manipulation

Installation from source

  1. Clone the github repository using:
git clone https://github.com/UBC-MDS/mds_array_manipulation.git
  1. Change to the project root directory
cd mds_array_manipulation
  1. You can install mds_array_manipulation package using poetry
poetry install

If you dont have poetry installed in your base environment, you can follow the installation guide for poetry.

Features

Contains functions: Searching, Sorting, Counting non-zero elements, Finding indices of max value. This package is a group-17 project for the UBC MDS DSCI 524 (Collaborative Software Development) course.

Dependencies

  • Python 3 or greater

Usage

A full vignette can be found on the documentation site here

Example usage:

>>> import numpy as np
>>> from mds_array_manipulation.search_array import search_array
>>> from mds_array_manipulation.argmax import argmax
>>> from mds_array_manipulation.sort_array import sort_array
>>> from mds_array_manipulation.count_nonzero_elements import count_nonzero_elements

>>> arr = np.array([20, 10, 40, 30, 50, 90, 60])
>>> search_array(arr, 50)
    4
>>> argmax(arr)
    5
>>> sort_array(arr)
    array([10, 20, 30, 40, 50, 60, 90])
>>> count_nonzero_elements(arr)
    7

Running Unit Tests

Execute the following in the project root directory after the package has been installed:

poetry run pytest

To get the coverage report, run the following code:

poetry run pytest tests/ --cov=src/mds_array_manipulation/

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

Contributors

  • Sean McKay - @sean-m-mckay
  • Kittipong Wongwipasamitkun (Jo) - @jokittipong
  • Yan Zeng - @Owl64901
  • Aishwarya Nadimpally - @Aishwarya120111

License

mds_array_manipulation was created by Kittipong Wongwipasamitkun, Sean Mckay, Yan Zeng, Aishwarya Nadimpally. It is licensed under the terms of the MIT license for software code part including source code examples in the documentation and it is licensed under the terms of the Attribution-ShareAlike 4.0 International, for Parts Other than the Software Code (Package Documentation, Data, Text, and any Media). See LICENSE.

Credits

mds_array_manipulation was created with cookiecutter and the py-pkgs-cookiecutter template.

References

  • Sedgewick, Robert (1983). Algorithms. Addison-Wesley. p. 95. ISBN 978-0-201-06672-2.
  • NumPy Developers (2008-2024). NumPy documentation. Version: 2.0.dev0

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

mds_array_manipulation-0.0.10.tar.gz (11.0 kB view hashes)

Uploaded Source

Built Distribution

mds_array_manipulation-0.0.10-py3-none-any.whl (13.3 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