utilfunction


Nameutilfunction JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/DSDanielPark/utilfunction
SummaryThe Python package utilfunction wraps and distributes useful functions in an easy-to-use way.
upload_time2024-06-13 10:21:25
maintainerNone
docs_urlNone
authorparkminwoo
requires_python>=3.6
licenseNone
keywords utils utility preprocessing analysis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Development Status :: 3 - Alpha <br>
*Copyright (c) 2023 MinWoo Park*
<br>

# util-function
![Util-Func](https://img.shields.io/badge/pypi-utilfunction-orange)
![Pypi Version](https://img.shields.io/pypi/v/utilfunction.svg)
[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v2.0%20adopted-black.svg)](code_of_conduct.md)
[![Python Version](https://img.shields.io/badge/python-3.6%2C3.7%2C3.8-black.svg)](code_of_conduct.md)
![Code convention](https://img.shields.io/badge/code%20convention-pep8-black)

The Python package utilfunction wraps and distributes useful functions in an easy-to-use way. We have collected functions that are simpler in function than many distributed Python packages or whose category is ambiguous.

For personal purposes, I am curating repetitive functions and planning to categorize and distribute them along with documentation in the future. I recommend not using them until major version 1.
<br>

# Installation
```
pip install utilfunction
```
```
$ pip install git+https://github.com/dsdanielpark/util-function.git
```


<br>

# Features
`path_finder.py` - function: find_all <br>
 Find the path of a file or folder. 
```python
from utilfunction import find_all

nii_file_list = find_all('./home', 'file', 'mask.nii.gz')
```
<br>

`astyper.py` - function: col_converter <br>
Restores a column whose array is stored as a string type back to an array type.
```python
from utilfunction import col_convert

df_has_converted_col = col_convert(df, "embedding_arrays")
```

<br>

`beep.py` - function: beep <br>
Make beep
```python
from utilfunction import beep

beep()

sec=10
feq=800
beep(sec, feq)
```

<br>


`bib2md.py` - function: bib2md <br>
Convert `bib file` to `markdown file`  
```python
from utilfunction import bib2md

bib_path = './sample_data/attention_based.bib'
save_path = './sample_data/attention_based.md'
title_key = 'title'

bib2md(bib_path, title_key, save_path)

```

<br>

`pq.py` - function: df_to_pq <br>
pd.DataFrame object to parquet object
```python
from utilfunction import df_to_pq

example_df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
output_folder = 'output'
output_file_name = 'example.parquet'
df_to_pq(example_df, output_folder, output_file_name)
```

<br>

`pq.py` - function: gen_hex <br>
Generating random hex

```python
from utilfunction import gen_hex

gen_hex(8)
```


# How to Contribute
Please create a pull request for any function that is useful and simple to reuse. Create a function, and write a tutorial with the same name as the function in the doc folder. Any snippet that you are comfortable with and use often will do. However, some contents may be revised and adjusted later for convenience.

1. Create a Python file containing functions in [`utilfunction folder`](https://github.com/DSDanielPark/utilfunction/tree/main/utifunc). You must include formatting and doc strings in your function.
2. Write brief explanations and examples in the [`doc folder`](https://github.com/DSDanielPark/utilfunction/tree/main/doc)
3. Write a one-line code example in README.md
5. Make a Pull Request
<br>

Please refer to the `find_all` function in [`path_finder.py`](https://github.com/DSDanielPark/utilfunction/blob/main/utifunc/path_finder.py).

<br>

- Styled with black `black .`
- Lnted with pylint `pylint --rcfile=setup.cfg util-function/`
- Type-checked with mypy `mypy util-function/`
- Pass the pytest unit tests `pytest`



# Notice
- This repo goes through a simple QA process, there are no major refactoring plans, and it's not a planned project, so it's in alpha.
- If there is a reference, please list it at the top of each Python file.
- Coverage of Python versions is subject to change. However, the code formatting is changed to black during the QA process.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/DSDanielPark/utilfunction",
    "name": "utilfunction",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "Utils, Utility, Preprocessing, Analysis",
    "author": "parkminwoo",
    "author_email": "parkminwoo1991@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/02/8c/6f748d4bdcbdf739aea7fb56b004906e42fdb0ffdcef183ab3819c9228de/utilfunction-1.0.2.tar.gz",
    "platform": null,
    "description": "Development Status :: 3 - Alpha <br>\r\n*Copyright (c) 2023 MinWoo Park*\r\n<br>\r\n\r\n# util-function\r\n![Util-Func](https://img.shields.io/badge/pypi-utilfunction-orange)\r\n![Pypi Version](https://img.shields.io/pypi/v/utilfunction.svg)\r\n[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v2.0%20adopted-black.svg)](code_of_conduct.md)\r\n[![Python Version](https://img.shields.io/badge/python-3.6%2C3.7%2C3.8-black.svg)](code_of_conduct.md)\r\n![Code convention](https://img.shields.io/badge/code%20convention-pep8-black)\r\n\r\nThe Python package utilfunction wraps and distributes useful functions in an easy-to-use way. We have collected functions that are simpler in function than many distributed Python packages or whose category is ambiguous.\r\n\r\nFor personal purposes, I am curating repetitive functions and planning to categorize and distribute them along with documentation in the future. I recommend not using them until major version 1.\r\n<br>\r\n\r\n# Installation\r\n```\r\npip install utilfunction\r\n```\r\n```\r\n$ pip install git+https://github.com/dsdanielpark/util-function.git\r\n```\r\n\r\n\r\n<br>\r\n\r\n# Features\r\n`path_finder.py` - function: find_all <br>\r\n Find the path of a file or folder. \r\n```python\r\nfrom utilfunction import find_all\r\n\r\nnii_file_list = find_all('./home', 'file', 'mask.nii.gz')\r\n```\r\n<br>\r\n\r\n`astyper.py` - function: col_converter <br>\r\nRestores a column whose array is stored as a string type back to an array type.\r\n```python\r\nfrom utilfunction import col_convert\r\n\r\ndf_has_converted_col = col_convert(df, \"embedding_arrays\")\r\n```\r\n\r\n<br>\r\n\r\n`beep.py` - function: beep <br>\r\nMake beep\r\n```python\r\nfrom utilfunction import beep\r\n\r\nbeep()\r\n\r\nsec=10\r\nfeq=800\r\nbeep(sec, feq)\r\n```\r\n\r\n<br>\r\n\r\n\r\n`bib2md.py` - function: bib2md <br>\r\nConvert `bib file` to `markdown file`  \r\n```python\r\nfrom utilfunction import bib2md\r\n\r\nbib_path = './sample_data/attention_based.bib'\r\nsave_path = './sample_data/attention_based.md'\r\ntitle_key = 'title'\r\n\r\nbib2md(bib_path, title_key, save_path)\r\n\r\n```\r\n\r\n<br>\r\n\r\n`pq.py` - function: df_to_pq <br>\r\npd.DataFrame object to parquet object\r\n```python\r\nfrom utilfunction import df_to_pq\r\n\r\nexample_df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})\r\noutput_folder = 'output'\r\noutput_file_name = 'example.parquet'\r\ndf_to_pq(example_df, output_folder, output_file_name)\r\n```\r\n\r\n<br>\r\n\r\n`pq.py` - function: gen_hex <br>\r\nGenerating random hex\r\n\r\n```python\r\nfrom utilfunction import gen_hex\r\n\r\ngen_hex(8)\r\n```\r\n\r\n\r\n# How to Contribute\r\nPlease create a pull request for any function that is useful and simple to reuse. Create a function, and write a tutorial with the same name as the function in the doc folder. Any snippet that you are comfortable with and use often will do. However, some contents may be revised and adjusted later for convenience.\r\n\r\n1. Create a Python file containing functions in [`utilfunction folder`](https://github.com/DSDanielPark/utilfunction/tree/main/utifunc). You must include formatting and doc strings in your function.\r\n2. Write brief explanations and examples in the [`doc folder`](https://github.com/DSDanielPark/utilfunction/tree/main/doc)\r\n3. Write a one-line code example in README.md\r\n5. Make a Pull Request\r\n<br>\r\n\r\nPlease refer to the `find_all` function in [`path_finder.py`](https://github.com/DSDanielPark/utilfunction/blob/main/utifunc/path_finder.py).\r\n\r\n<br>\r\n\r\n- Styled with black `black .`\r\n- Lnted with pylint `pylint --rcfile=setup.cfg util-function/`\r\n- Type-checked with mypy `mypy util-function/`\r\n- Pass the pytest unit tests `pytest`\r\n\r\n\r\n\r\n# Notice\r\n- This repo goes through a simple QA process, there are no major refactoring plans, and it's not a planned project, so it's in alpha.\r\n- If there is a reference, please list it at the top of each Python file.\r\n- Coverage of Python versions is subject to change. However, the code formatting is changed to black during the QA process.\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "The Python package utilfunction wraps and distributes useful functions in an easy-to-use way.",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/DSDanielPark/utilfunction"
    },
    "split_keywords": [
        "utils",
        " utility",
        " preprocessing",
        " analysis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "17e005d0574f2aaa64f2f8456d8006d4409be1a13b67474ca6c4a58f5e774699",
                "md5": "739ce0072f7e257ef41ff3a8f8a766f2",
                "sha256": "2b39240f221d9de4dd23963ae2391cf6dcd446f301fe6136482342c09942e019"
            },
            "downloads": -1,
            "filename": "utilfunction-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "739ce0072f7e257ef41ff3a8f8a766f2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 10876,
            "upload_time": "2024-06-13T10:21:24",
            "upload_time_iso_8601": "2024-06-13T10:21:24.130795Z",
            "url": "https://files.pythonhosted.org/packages/17/e0/05d0574f2aaa64f2f8456d8006d4409be1a13b67474ca6c4a58f5e774699/utilfunction-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "028c6f748d4bdcbdf739aea7fb56b004906e42fdb0ffdcef183ab3819c9228de",
                "md5": "71464eb70984c0673adef70709ce03ca",
                "sha256": "56f3df2b9f91eb1382feb361d66015c6f620cb9ca61f21ad5ab5edd6e0de18ba"
            },
            "downloads": -1,
            "filename": "utilfunction-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "71464eb70984c0673adef70709ce03ca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 10842,
            "upload_time": "2024-06-13T10:21:25",
            "upload_time_iso_8601": "2024-06-13T10:21:25.926460Z",
            "url": "https://files.pythonhosted.org/packages/02/8c/6f748d4bdcbdf739aea7fb56b004906e42fdb0ffdcef183ab3819c9228de/utilfunction-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-13 10:21:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DSDanielPark",
    "github_project": "utilfunction",
    "github_not_found": true,
    "lcname": "utilfunction"
}
        
Elapsed time: 0.25325s