Skip to main content

A small array utlity library

Project description

Array utility

A simple python utility library

What is PyArray ?

Well, PyArray is a simple python-array-utlity library. It contains a set of a array methods which can speed up your development.

How to use it?

Create a pyarray list

import pyarray

PyArray types

Strings

pyarray.string()
# strings

Integers

pyarray.integer()
# integer

Floats

pyarray.floating()
# floating point

Dictionaried , booleans and lists

#dictionaries
pyarray.dictionary()

#boolean values
pyarray.boolean()

# lists
pyarray.lists()

Create a list

arr = pyarray.List(pyarray.integer())

Methods

Length

arr.len()

Add

arr.add(4)

# The array don't support duplicate elements
# no element is added if it already exists 
# int the list

elementAt(index:integer)

index = 1
arr.elementAt(index)

median

# find the median
# only for integers and floats
arr.median()

delete_index(index:integer)

arr.delete_index(-1)

search_insert_position

target = 9
arr.search_insert_postion(target)

index

arr.index()

peak

# the index of maximum element
arr.peak_index()

all

arr.all()
# returns all the element

count

arr.count(5)

Maximum and minimum

# maximum
arr.range().maximum()

# minimum
arr.range().minimum()

Choice

arr.choice()

# gives a random element

Other methods

# sort the array
arr.sort()

# find an element
arr.find()

# delete an element
arr.delete(3)

# clear all the element
arr.clear()

# reverse an array
arr.reverse()

arr.alternate_index()

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

pyarray-0.2.tar.gz (3.3 kB view hashes)

Uploaded Source

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