Saravanan666/pypi-org huggingface dataset:
Package: numpickle
numpickleFaster loading of pandas data frames by saving them as numpy arrays and pickling their meta info (row+column names, column dtype info).The bigger the data frame, the bigger the gain of speed when reading compared to loading a text file.
(E.g., a several GB RAM-consuming matrix took minutes to read-in using normalpd.read_csv(), but took only seconds to load when usingnumpickle.load_numpickle()).all_numeric=Trueaccelerates loading by ~ 7 times.Also mentioned in mymedium article.Installpip install numpickleUsageimport pandas as pd
import numpickle as npl


# create example data frame with non-numeric and numeric columns
df = pd.DataFrame([[1, 2,'a'], [3, 4, 'b']])
df.columns = ["A", "B", "C"]
df.index = ["row1", "row2"]

df
#       A  B  C
# row1  1  2  a
# row2  3  4  b

df.dtypes
# A     int64
# B     int64
# C    object
# dtype: object




# save data frame as numpy array and pickle row and column names
# into helper pickle file "/home/user/test.npy.pckl"
npl.save_numpickle(df, "/home/user/test.npy")

# load the saved data
df_ = npl.load_numpickle("/home/user/test.npy")

df_
#       A  B  C
# row1  1  2  a
# row2  3  4  b


df_.dtypes
# A     int64
# B     int64
# C    object
# dtype: object

all(df == df_)
# True






####################################
# data frames with numeric-only values
###################################

# If you have a data frame with only numeric values, put all_numeric=True .
# Then dtypes is set to None and the loading will be slightly faster.
df = pd.DataFrame([[1, 2], [3, 4]])
df.columns = ["A", "B"]
df.index = ["row1", "row2"]

df
#       A  B
# row1  1  2
# row2  3  4

df.dtypes
# A     int64
# B     int64
# dtype: object

# save numeric-only data frame
npl.save_numpickle(df, "/home/user/test.npy", all_numeric=True)
# load numeric-only data frame (it recognizes automatically that it is numeric only
# because dtypes=None or not existent in pickle file
df_ = npl.load_numpickle("/home/user/test.npy")


###################################
# save a csv or tab file as numpickle file(s) and delete original files
###################################
npl.save_file_as_numpickle(fpath, sep="\t", ending=".tab", all_numeric=True, deletep=True)
# the data are read by pd.read_csv(), additional arguments for the reading process can be given
# into the argument list, they will be forwarded to pd.read_csv() by *args, **kwargs
# for the output file name, the `ending` is replaced by ".npy" and ".npy.pckl".
# So choose the separator and ending accordingly when file is a csv file (sep=",", ending=".csv").
Package: numpoly
Numpoly is a generic library for creating, manipulating and evaluating
arrays of polynomials based onnumpy.ndarrayobjects.Intuitive interface for users experienced withnumpy, as the library
provides a high level of compatibility with thenumpy.ndarray, including
fancy indexing, broadcasting,numpy.dtype, vectorized operations to name
a few.Computationally fast evaluations of lots of functionality inherent fromnumpy.Vectorized polynomial evaluation.Support for arbitrary number of dimensions.Native support for lots ofnumpy.<name>functions usingnumpy’s
compatibility layer (which also exists asnumpoly.<name>equivalents).Support for polynomial division through the operators/,%anddivmod.Extra polynomial specific attributes exposed on the polynomial objects likepoly.exponents,poly.coefficients,poly.indeterminantsetc.Polynomial derivation through functions likenumpoly.derivative,numpoly.gradient,numpoly.hessianetc.Decompose polynomial sums into vector of addends usingnumpoly.decompose.Variable substitution throughnumpoly.call.InstallationInstallation should be straight forward:pipinstallnumpolyExample UsageConstructing polynomial is typically done using one of the available
constructors:>>>importnumpoly>>>numpoly.monomial(start=0,stop=3,dimensions=2)polynomial([1,q0,q0**2,q1,q0*q1,q1**2])It is also possible to construct your own from symbols together withnumpy:>>>importnumpy>>>q0,q1=numpoly.variable(2)>>>numpoly.polynomial([1,q0**2-1,q0*q1,q1**2-1])polynomial([1,q0**2-1,q0*q1,q1**2-1])Or in combination with numpy objects using various arithmetics:>>>q0**numpy.arange(4)-q1**numpy.arange(3,-1,-1)polynomial([-q1**3+1,-q1**2+q0,q0**2-q1,q0**3-1])The constructed polynomials can be evaluated as needed:>>>poly=3*q0+2*q1+1>>>poly(q0=q1,q1=[1,2,3])polynomial([3*q1+3,3*q1+5,3*q1+7])Or manipulated using various numpy functions:>>>numpy.reshape(q0**numpy.arange(4),(2,2))polynomial([[1,q0],[q0**2,q0**3]])>>>numpy.sum(numpoly.monomial(13)[::3])polynomial(q0**12+q0**9+q0**6+q0**3+1)InstallationInstallation should be straight forward frompip:pipinstallnumpolyAlternatively, to get the most current experimental version, the code can be
installed fromGithubas follows:First time around, download the repository:gitclonegit@github.com:jonathf/numpoly.gitEvery time, move into the repository:cdnumpoly/After  the first time, you want to update the branch to the most current
version ofmaster:gitcheckoutmastergitpullInstall the latest version ofnumpolywith:pipinstall.DevelopmentInstallingnumpolyfor development can
be done from the repository root with the command:pip install -e .[dev]The deployment of the code is done with Python 3.10 and dependencies are then
fixed using:pip install -r requirements-dev.txtTestingTo run test:pytest--doctest-modulesnumpolytestdocs/user_guide/*.rstREADME.rstDocumentationTo build documentation locally on your system, usemakefrom thedoc/folder:cddoc/makehtmlRunmakewithout argument to get a list of build targets. All targets
stores output to the folderdoc/.build/html.Note that the documentation build assumes thatpandocis installed on your
system and available in your path.
Package: numprim
Este es un ejemplo simple de un paquete Python. Este paquete contiene una funcion para realizar una operacion en la cual nos dice los numeros primos que hay en un rango de 1 a n, siendo n un numero que se introduce como parametro.This program is free software: You can redistribute it and/or modify it under the terms of license by the Free Software Foundation, either version 3 of the License(at your option) any other version.
Package: numprimodeprueba
Este es un ejemplo simple de un paquete Python. Este paquete contiene una funciÃ³n en Python para calcular los nÃºmeros primos entre 1 y n, donde n es un parÃ¡metro de la funciÃ³n.This program is free software: You can redistribute it and/or modify it under the terms of license by the Free Software Foundation, either version 3 of the License any other version.
Package: numprimomeus
Este es un ejemplo simple de un paquete Python. Este paquete contiene una funciÃ³n “numero_primo_hasta_n” para listar los nÃºmeros primos entre 1 y n.
Es un ejercicio para la asignatura de fundamentos de python.
This program is free software: You can redistribute it and/or modify it under the terms of license by the Free Software Foundation, either version 3 of the License(at your option) any other version.
Package: num-primos-py
Este es un ejemplo simple de un paquete Python.
Este paquete contiene la implementaciÃ³n de una funciÃ³n escrita en Python para calcular los nÃºmeros primos entre 1 y n, donde n es un parÃ¡metro de la funciÃ³n.This program is free software: You can redistribute it and/or modify it under the terms of license by the Free Software Foundation, either version 3 of the License(at your option) any other version.
Package: numproto
NumProtoNumProtois a simple python3.6+ library to serialize and deserialize numpy
arrays into and from protobuf messages.InstallationYou can install NumProto from the PyPI package:$pipinstallnumprotoUsageNumProto serializes a numpy array into anNDArraymessage as specified inndarray.proto:syntax="proto3";packagenumproto.protobuf;messageNDArray{bytesndarray=1;}This library provides two methods: one for serializationndarray_to_protoand
one for deserializationproto_to_ndarray.importnumpyasnpfromnumprotoimportndarray_to_proto,proto_to_ndarraynda=np.arange(10)serialized_nda=ndarray_to_proto(nda)deserialized_nda=proto_to_ndarray(serialized_nda)assertnp.array_equal(nda,deserialized_nda)Re-using the proto files in another projectRe-distributing*.protofiles is notoriously difficult. In order to make this
easier thendarray.protofile is installed together with the python package.This allows us to simply pass thesite-packagespath as an import path toprotoc.To get the correct path ofsite-packagescheck theLocationkey when
runningpip show numproto.For example let's say we want to create a newprotofile and importNDArrayto use within one of our defined messages:syntax="proto3";import"numproto/protobuf/ndarray.proto";messageMyMessage{numproto.protobuf.NDArraymy_array=1;}And to compile usinggrpcio-toolssimply do:$python-mgrpc_tools.protoc-I/usr/lib/python3.6/site-packages/-I./--python_out=.--grpc_python_out=.my_proto.proto(you may need to adjust the location ofsite-packages)TestsTo run the tests first install thenumprotopackage from source in development
mode and then run the tests usingpytest:$gitclonehttps://github.com/xainag/numproto.git
$cdnumproto
$pipinstall-e.[dev]$pytest
Package: numpy
NumPy is the fundamental package for scientific computing with Python.Website:https://www.numpy.orgDocumentation:https://numpy.org/docMailing list:https://mail.python.org/mailman/listinfo/numpy-discussionSource code:https://github.com/numpy/numpyContributing:https://www.numpy.org/devdocs/dev/index.htmlBug reports:https://github.com/numpy/numpy/issuesReport a security vulnerability:https://tidelift.com/docs/securityIt provides:a powerful N-dimensional array objectsophisticated (broadcasting) functionstools for integrating C/C++ and Fortran codeuseful linear algebra, Fourier transform, and random number capabilitiesTesting:NumPy requirespytestandhypothesis.  Tests can then be run after installation with:python -c "import numpy, sys; sys.exit(numpy.test() is False)"Code of ConductNumPy is a community-driven open source project developed by a diverse group ofcontributors. The NumPy leadership has made a strong
commitment to creating an open, inclusive, and positive community. Please read theNumPy Code of Conductfor guidance on how to interact
with others in a way that makes our community thrive.Call for ContributionsThe NumPy project welcomes your expertise and enthusiasm!Small improvements or fixes are always appreciated. If you are considering larger contributions
to the source code, please contact us through themailing
listfirst.Writing code isn’t the only way to contribute to NumPy. You can also:review pull requestshelp us stay on top of new and old issuesdevelop tutorials, presentations, and other educational materialsmaintain and improveour websitedevelop graphic design for our brand assets and promotional materialstranslate website contenthelp with outreach and onboard new contributorswrite grant proposals and help with other fundraising effortsFor more information about the ways you can contribute to NumPy, visitour website.
If you’re unsure where to start or how your skills fit in, reach out! You can
ask on the mailing list or here, on GitHub, by opening a new issue or leaving a
comment on a relevant issue that is already open.Our preferred channels of communication are all public, but if you’d like to
speak to us in private first, contact our community coordinators atnumpy-team@googlegroups.comor on Slack (writenumpy-team@googlegroups.comfor
an invitation).We also have a biweekly community call, details of which are announced on the
mailing list. You are very welcome to join.If you are new to contributing to open source,this
guidehelps explain why, what,
and how to successfully get involved.
Package: numpy2gif
# numpy2gif
Python library to convert single and multiple numpy images to a gif image without PIL or pillow. OpenCV does not support gif images. This a fork of array2gif from Tanya Schlusser found at:https://github.com/tanyaschlusser/array2gifInstall it withsetup.py installor withpip install numpy2gif# UsageYou can use the library this way:from __future__ import print_function
from numpy2gif import write_gif
import cv2
images = [cv2.cvtColor(cv2.imread(“Images/number”+str(i)+”.bmp”), cv2.COLOR_BGR2RGB) for i in range(1, 5)]
print(type(images[0]))
print(images[0].shape, images[0].dtype)
write_gif(images, “countdown.gif”, fps=3)
write_gif(images[0], “one.gif”)Try a backward test from converting a gif to numpy frames with the external module gif2numpy and back to a multiple gif image with numpy2gif:from __future__ import print_function
from gif2numpy import convert
from numpy2gif import write_gif
import cv2image = “Images/Rotating_earth.gif”
frames, exts, image_specs = convert(image, BGR2RGB=False)
print(“len(frames), len(exts), exts[0][‘delay_time’]”, len(frames), len(exts), exts[0][‘delay_time’])
write_gif(frames, ‘Rotating_earth_new.gif’, fps=12)
write_gif(frames[0], ‘earth.gif’)# Version history1.0: first release# DependenciesYou need to install numpy by:pip install numpy
Package: numpy-allocator
Memory management inNumPy**NumPy is a trademark owned byNumFOCUS.Customize Memory AllocatorsΑ metaclass is used to override the internal data memory routines. The metaclass has four optional fields:>>>importctypes>>>importctypes.util>>>importnumpy_allocator>>>my=ctypes.CDLL(ctypes.util.find_library('my'))>>>classmy_allocator(metaclass=numpy_allocator.type):..._calloc_=ctypes.addressof(my.calloc_func)..._free_=ctypes.addressof(my.free_func)..._malloc_=ctypes.addressof(my.malloc_func)..._realloc_=ctypes.addressof(my.realloc_func)...An example using the allocator>>>importnumpyasnp>>>withmy_allocator:...a=np.array([1,2,3])...>>>my_allocator.handles(a)True
Package: numpy-array-buffer
numpy_array_bufferLibrary for buffers used in real-time computation:RingBuffer: when full overwrites oldest rowDownsamplingBuffer: when full downsamples full bufferExamplering_buffer = RingBuffer(3,2, column_names=["x", "y"])
for i in range(6):
    ring_buffer.append([i, i + 10])
    print(f"{i=}, y: {ring_buffer.get_col('x')}")output:i=0, y: [0.]
i=1, y: [0. 1.]
i=2, y: [0. 1. 2.]
i=3, y: [1. 2. 3.]
i=4, y: [2. 3. 4.]
i=5, y: [3. 4. 5.]Downsampled arraydownsampling_buffer = DownsamplingBuffer(4, 2)
for i in range(9):
    data_object = [i, i + 10]
    downsampling_buffer.append(data_object)
    print(f"{i=}, Arr: {downsampling_buffer.get_array()[:,0]}")output:i=0, Arr: [0.]
i=1, Arr: [0. 1.]
i=2, Arr: [0. 1. 2.]
i=3, Arr: [0. 2.]
i=4, Arr: [0. 2. 4.]
i=5, Arr: [0. 4.]
i=6, Arr: [0. 4.]
i=7, Arr: [0. 4.]
i=8, Arr: [0. 4. 8.]Similar packages:Look at if functionality is the same, or compare benchmark:https://github.com/eric-wieser/numpy_ringbuffer/blob/master/numpy_ringbuffer/__init__.pyhttps://stackoverflow.com/questions/8908998/ring-buffer-with-numpy-ctypesDevelop:pip install -e .
Package: numpyarray-to-latex
Format numpy arrays as LaTeX arrays. This is a fork ofarray_to_latexby@josephcslater.repository:https://github.com/benmaier/numpyarray_to_latex/documentation:http://numpyarray-to-latex.readthedocs.io/>>>importnumpyasnp>>>fromnumpyarray_to_lateximportto_ltx>>>tex=to_ltx(np.random.randn(2,2))>>>print(tex)\left(\begin{array}2.0156&-0.3230\\0.0477&0.0184\end{array}\right)Installpipinstallnumpyarray_to_latexnumpyarray_to_latexwas developed and tested forPython 3.6Python 3.7Python 3.8Python 3.9Python 3.10So far, the package’s functionality was tested on Mac OS X and CentOS
only.Dependenciesnumpyarray_to_latexdirectly depends on the following packages which
will be installed bypipduring the installation processnumpy>=1.0DocumentationThe full documentation is available atnumpyarray-to-latex.readthedocs.io.ExamplesDefault Pythonimportnumpyasnpfromnumpyarray_to_latex.jupyterimportto_jupfromnumpyarray_to_lateximportto_ltxtex=to_ltx(np.random.randn(2,2))print(tex)\left(
\begin{array}
  2.0156 & -0.3230\\
  0.0477 &  0.0184
\end{array}
\right)print(to_ltx(np.random.randn(2,2),latexarraytype='array',is_row_vector=False,mark_color='yellow',mark_elements=[(1,1)],brackets='(]',separate_columns=[1,2],separate_rows=[1,2],))\left(
\begin{array}{c|c}
  0.3498 &  0.4393\\
  \hline
 -0.8521 & \colorbox{yellow}{$-0.6412$}
\end{array}
\right]In Jupyter Notebooksimportnumpyasnpfromnumpyarray_to_latex.jupyterimportto_jupto_jup(np.random.randn(10,10),mark_elements=[(1,1),(2,3),(7,0)],separate_columns=[1,2],# columns & rows that don't exist will be ignoredseparate_rows=[1,2],)to_jup(np.random.randn(2),mark_elements=[1,],separate_columns=[1,2],separate_rows=[1,2],)to_jup(np.random.randn(2),is_row_vector=False,mark_elements=[1,],separate_columns=[1,2],separate_rows=[1,2,3,4],# columns that don't exist will be ignoredmark_color='yellow',brackets='(]',)to_jup(np.random.randn(2,2),latexarraytype='Vmatrix',is_row_vector=False,separate_rows=[1],)to_jup(np.random.randn(2,2)+1j*np.random.randn(2,2),mark_elements=[(0,1)],)to_jup(np.random.randn(2,2)+1j*np.random.randn(2,2),mark_elements=[(0,1)],fmt='{:4.2e}',)ChangelogChanges are logged in aseparate
file.LicenseThis project is licensed under theMIT
License.
Note that this excludes any images/pictures/figures shown here or in the
documentation.ContributingIf you want to contribute to this project, please make sure to read thecode of
conductand thecontributing
guidelines.
In case you’re wondering about what to contribute, we’re always
collecting ideas of what we want to implement next in theoutlook
notes.Dev notesFork this repository, clone it, and install it in dev mode.gitclonegit@github.com:YOURUSERNAME/numpyarray_to_latex.gitmakeIf you want to upload to PyPI, first convert the newREADME.mdtoREADME.rstmakereadmeIt will give you warnings about bad.rst-syntax. Fix those errors inREADME.rst. Then wrap the whole thingmakepypiIt will probably give you more warnings about.rst-syntax. Fix those
until the warnings disappear. Then domakeupload
Package: numpyasciiart
Converts an image to ASCII art using numpy / numexpr / cv2Tested against Windows 10 / Python 3.11 / Anacondapip install numpyasciiartConvertanimagetoASCIIart.Parameters:img(strornumpy.ndarray):url/path/base64/bin/np.array/PIL.Imagerepresentinganimage.width(int):WidthoftheASCIIartoutput.height_adjust_stretch(float):VerticalstretchfactorfortheASCIIart.letters(str):ThesetofcharacterstouseforvaryingshadesintheASCIIart.Returns:str:ASCIIartrepresentationoftheinputimage.Example:ToconvertanimageandprintitasASCIIart:fromnumpyasciiartimportto_asciipic=to_ascii(img=r"https://www.python.org/static/img/python-logo.png",width=160,height_adjust_stretch=2.5,letters="█▓▓▒▒░░ ",)print(pic)
Package: numpy-camera
Numpy CameraLook away! Still in devSimple threaded camera that doesn't need OpenCV.Installpip install -U numpy_cameraUsagec = ThreadedCamera((640,480))
c.start()        # starts internal loop
frame = c.read() # numpy array
c.stop()         # stops internal loop
c.join()         # gathers back up the threadMIT LicenseCopyright (c) 2020 Kevin J. WalchkoPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Package: numpy-choices
Some useful np.random functions$pipinstallnumpy-choicesfromnumpy_choicesimportget_random_floats,get_random_ints,get_random_items_from_listrand=get_random_items_from_list(list(range(1,20)),size=10,replace=False,p=None,replace_raise=False)print(rand)# [ 6 16 10  2  9  5 12 15  4 19]print(get_random_ints(low=0,high=20,size=10))# [ 0 14  3 14  3 11 15  0  4  5]print(get_random_floats(low=0,high=20,size=10))# [10.69714652  9.85398014  1.79753204 18.85165542  8.35101616  9.00431022#   0.04652976  4.05292685 13.6940055   2.25818349]
Package: numpycnn
Convolutional neural network implementation using NumPy.
Just three layers are created which are convolution (conv for short), ReLU, and max pooling.
The major steps involved are as follows:Reading the input image.Preparing filters.Conv layer: Convolving each filter with the input image.ReLU layer: Applying ReLU activation function on the feature maps (output of conv layer).Max Pooling layer: Applying the pooling operation on the output of ReLU layer.Stacking conv, ReLU, and max pooling layersThe project is tested using Python 3.5.2 installed inside Anaconda 4.2.0 (64-bit)
NumPy version used is 1.14.0The file namedexample.pyis an example of using the project.The code starts by reading an input image. That image can be either single or multi-dimensional image.
In this examplel, an input gray is used and this is why it is required to ensure the image is already gray.The filters of the first conv layer are prepared according to the input image dimensions. The filter is created by specifying the following:Number of filters.Size of first dimension.Size of second dimension.Size of third dimension and so on.Because the previous image is just gray, then the filter will have just width and height and no depth. That is why it is created by specifying just three numbers (number of filters, width, and height).The code can still work with RGb images. The only difference is using filters of similar shape to the image. If the image is RGB and not converted to gray, then the filter will be created by specifying 4 numbers (number of filters, width, height, and number of channels).For more details, refer to the article describing this project which is titled "Building Convolutional Neural Network using NumPy from Scratch". It is available in these links:LinkedIn:https://www.linkedin.com/pulse/building-convolutional-neural-network-using-numpy-from-ahmed-gad/KDnuggets:https://www.kdnuggets.com/2018/04/building-convolutional-neural-network-numpy-scratch.htmlIt is also translated into Chinese:http://m.aliyun.com/yunqi/articles/585741Contact the author:KDnuggets:https://www.kdnuggets.com/author/ahmed-gadLinkedIn:https://www.linkedin.com/in/ahmedfgadFacebook:https://www.facebook.com/ahmed.f.gaddahmed.f.gad@gmail.comahmed.fawzy@ci.menofia.edu.eg
Package: numpy-cursor
NumPy CursorThis repository contains a Python implementation of a cursor for NumPy matrices. The cursor allows you to conveniently move through a matrix and read or modify its values.The cursor class has the following methods:__init__(self, matrix): Initializes the cursor with a NumPy matrix.left(self, steps=1): Moves the cursor left bystepscolumns.right(self, steps=1): Moves the cursor right bystepscolumns.up(self, steps=1): Moves the cursor up bystepsrows.down(self, steps=1): Moves the cursor down bystepsrows.move(self, row_steps, col_steps): Moves the cursor byrow_stepsrows andcol_stepscolumns.set(self, row, col): Set the cursor byrowrows andcolcolumns.coordinates: Returns the current row and column coordinates of the cursor.isEmpty: ReturnsTrueif the value of the matrix at the current cursor position is zero, andFalseotherwise.setItem(self, item): Setting the value of the cursor cell byitem.__repr__(self): Returns a string representation of the value of the matrix at the current cursor position.__str__(self): Returns a string representation of the value of the matrix at the current cursor position.The implementation also includes error checking to prevent moving the cursor beyond the boundaries of the matrix.