A package with japanese-related functions
Project description
Wagano is a Multi-purpose package designed for japanese-related functions. An extension of its features goes to a calculation.py file, where different features associated with math overlay.
Table of Contents
Requirements
There is one thing you must have installed (the basics) before installing this module:
- Python 3.6.8
It may work on other versions, however, it has not been tested whether it'll work on them or not.
Installation
One of the recommended ways to install wagano is by PyPi's pip.
pip install wagano
Another way to get wagano is to git clone.
git clone https://github.com/ichirod-japan/waganolib.git
Then you can run the setup file from there.
python setup.py install
(or if you're on a Unix-Like OS (such as MacOS or Linux), use sudo python setup.py install)
Help
If you need help or have an issue, do not hesitate to open one at https://github.com/ichirod-japan/waganolib/issues Very soon, this module is going to have a documentation to answer some of the basic questions. Remember before submitting an issue, check other issues (closed as well) and see if your question has already been answered.
build-source-code
If you want to use features that are currently in development, or you want to contribute to wagano, you will need to build wagano locally from its source code, rather than pip installing it.
Installing from source is fairly automated. The most work will involve compiling and installing all the wagano dependencies (not much, really). Once that is done, run the setup.py script which will attempt to auto-configure, build, and install wagano.
License
This library is distributed under the MIT License which can be found in the waganolib/LICENSE file.
Features
The following is a content table for all the features and only features of this README.md file.
Haversine
To use one of the basic functions on this module, also known as haversine you can copy the following code for testing:
print(calculation.haversine(52.370216, 4.895168, 52.520008,
13.404954) == 945793.4375088713)
Harversine gets you the ability to Calculate the great circle distance between two points on the earth (specified in decimal degrees), returns the distance in meters. All arguments must be of equal length. :param lon1: longitude of first place :param lat1: latitude of first place :param lon2: longitude of second place :param lat2: latitude of second place :return: distance in meters between the two sets of coordinates So far, this is not japanese-related but is included in calculation.py so as to help you in the field of math and algebra. Other calculation functions will be listed in future updates on here.
mean([])
Mean is a default feature that would allow you to Calculate the arithmetic mean ("the average") of data:
>>> mean([-1.0, 2.5, 3.25, 5.75])
2.625
The calculation of the average is a known default, but has been tweaked a little to fit the purpose.
median([])
Median is a feature that is similar to the one previously shown, mean, and it calculates the standard median of discrete data:
>>> median([2, 3, 4, 5])
3.5
Median has an extension which calculates the median, or 50th percentile, of data grouped into class intervals centred on the data values provided. E.g. if your data points are rounded to the nearest whole number:
>>> median_grouped([2, 2, 3, 3, 3, 4]) #doctest: +ELLIPSIS
2.8333333333...
This should be interpreted in this way: you have two data points in the class interval 1.5-2.5, three data points in the class interval 2.5-3.5, and one in the class interval 3.5-4.5. The median of these data points is 2.8333... Calculating variability or spread
stdev
stdev is a feature that calculates the standard deviation of sample data:
>>> stdev([2.5, 3.25, 5.5, 11.25, 11.75]) #doctest: +ELLIPSIS
4.38961843444...
If you have previously calculated the mean, you can pass it as the optional second argument to the four "spread" functions to avoid recalculating it:
>>> data = [1, 2, 2, 4, 4, 4, 5, 6]
>>> mu = mean(data)
>>> pvariance(data, mu)
2.5
Exceptions
_sum
Yet another feature in calculation.py is the _sum.
the _sum returns a high-precision sum of the given numeric data as a fraction,
together with the type to be converted to and the count of items.
If optional argument start is given, it is added to the total.
If data is empty, start (defaulting to 0) is returned.
Examples
--------
>>> _sum([3, 2.25, 4.5, -0.5, 1.0], 0.75)
(<class 'float'>, Fraction(11, 1), 5)
Some sources of round-off error will be avoided:
# Built-in sum returns zero.
>>> _sum([1e50, 1, -1e50] * 1000)
(<class 'float'>, Fraction(1000, 1), 3000)
Fractions and Decimals are also supported:
>>> from fractions import Fraction as F
>>> _sum([F(2, 3), F(7, 5), F(1, 4), F(5, 6)])
(<class 'fractions.Fraction'>, Fraction(63, 20), 4)
>>> from decimal import Decimal as D
>>> data = [D("0.1375"), D("0.2108"), D("0.3061"), D("0.0419")]
>>> _sum(data)
(<class 'decimal.Decimal'>, Fraction(6963, 10000), 4)
Mixed types are currently treated as an error, except that int is
allowed.
Summary
I don't think you expected this, but I won't list all features over here, you can find most of the features of calculation.py at https://github.com/python/cpython/blob/master/Lib/statistics.py, where most features reside. There is only a calculation.py file for now, since the module is still on 0.5.4, but the japanese-related features will be added very soon, and it is frantically being worked on!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wagano-0.5.4.tar.gz.
File metadata
- Download URL: wagano-0.5.4.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7c26f7867f44b9f84829f8151fbdd14293e55918771ddb3ef3e470128f3b569
|
|
| MD5 |
8cb95f204f9f4d5879cd38f02c3a38aa
|
|
| BLAKE2b-256 |
5172556f408fff2c7932542973821d5a525d8145bef8bb62d112f8a8ff906e73
|
File details
Details for the file wagano-0.5.4-py3-none-any.whl.
File metadata
- Download URL: wagano-0.5.4-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbce7b35e6b9e5cb1f6432ea8c41cfab229b4986e20df9b07e0439bdc3fecc98
|
|
| MD5 |
ce2be364647cacf0e68d7c3586c7bfc3
|
|
| BLAKE2b-256 |
68555acb12585e3befa71dc2404aa9f7355ce7970abc612b5becf188685226d6
|