Function easing life :)
Project description
pynut - Laurent Tupin
It provides various functions to simplify the users life.
Installation
You can install the package from PyPI:
python -m pip install pynut
The package is supported on Python 3.7 and above.
How to use
You can call a function as this example:
$ ----------------------------------------------------
>>> from pyNut import nutDate
>>> nutDate.today()
This is the libraries I am using with the package
$ ----------------------------------------------------
>>> beautifulsoup4==4.7.1
>>> exchangelib==4.7.2
>>> openpyxl==3.0.5
>>> pandas==1.1.3
>>> paramiko==2.6.0
>>> psutil==5.9.0
>>> pyodbc==4.0.32
>>> pywin32==303
>>> selenium==3.141.0
>>> xlrd==1.2.0
>>> XlsxWriter==1.3.5
>>> xlwings==0.20.8
To use nutAPI / Selenium Functionnalities:
$ ----------------------------------------------------
# To use Chrome Driver
# Go to chromedriver.chromium.org
# download and UnZip the folder
# Move it to Users/local/bin or C:\ProgramData\Anaconda3\Library\bin (Windows)
Documentation
Temporary documentation for nutDate :
from pyNut import nutDate as dat
dte_date = dat.fDte_formatToDate(dte_date, str_dateFormat = '%d/%m/%Y')
""" fDte_formatToDate makes sure you will have a varable with a date format
The first Argument is the Variable (date), and the format of the string if it is a sting
It allows you to avoid testing the type of the variable and get your get Date anyhow"""
int_dateDiff = dat.fInt_dateDifference(dte_date1, dte_date2)
""" fInt_dateDifference give you the difference in days between 2 dates"""
Date2 = dat.fDte_convertExcelInteger(Date)
""" fDte_convertExcelInteger takes an integer as input,
This is the integer you can find in Excel when it is a date
And return the associated date """
Temporary documentation for nutDataframe :
import pyNut.nutDataframe as dframe
bl_isempty = dframe.fBl_isDataframeEmpty(df_simple)
""" Test if a Dataframe is empty"""
df_simple = dframe.fDf_createSimpleDataframe()
""" Create a simple dataframe to make test"""
bl_compare, df_compare = dframe.fBl_compareDfCol({'df': df_1, 'colJoin': 'colJoin','colToCompare':'data'},
{'df': df_2,'colJoin': 'colJoin','colToCompare':'data'})
""" compare 2 dataframe one a numeric column by joining the df and returning the difference """
df_1['DataRounded'] = df_1['DataToBeRounded'].apply(lambda x: dframe.round_down(x))
""" Use the Math Function floor() - Able to add a decimals like in Excel
floor() rounds down. int() truncates.
The difference is clear when you use negative numbers
math.floor(-3.5) -4
int(-3.5) -3"""
df_2['DataRounded'] = df_2['DataToBeRounded'].apply(lambda x: dframe.round_up(x))
""" Use the Math Function ceil() - Able to add a decimals like in Excel"""
df_data = dframe.fDf_readCsv_enhanced(path, bl_header = None, str_sep = '|', l_names = range(33))
""" Use the pandas method read_csv
but resolving Parse Error and will try again after displaying a message
Also resolving UnicodeDecodeError by detecting the encoding and trying again accordingly """
df2 = dframe.fDf_removeDoublons(df1)
""" Remove all rows that are exactly the same"""
df2 = dframe.fDf_DropRowsIfNa_resetIndex(df1, l_colToDropNA = ['col1'])
""" Drop the rows where all defined columns will be Nan
And reset the index"""
df2 = dframe.dDf_fillNaColumn(df1, 'col2', 'col1')
""" Replace Nan in a column by the value in another column or a Constant """
df2 = dframe.fDf_fillColUnderCondition(df1, 'NameColumnToApply', df1['data'], 'NameColumn Condition', 'YES', bl_except = False)
''' Transform DF with condition
ValueToApply can be a value or a lambda function'''
Temporary documentation for nutFiles :
from pyNut import nutFiles as fl
l_fileList_consti = fl.fL_listFile(str_path_consti)
"" fL_listFile is listing all files in a folder using the library glob """
o_file = fl.fO_readfile_parquet(str_path)
""" fO_readfile_parquet reads parquet - require the libraries : pyarrow / fastparquet"""
END___________________
Project details
Release history Release notifications | RSS feed
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 pynut-1.3.3.tar.gz.
File metadata
- Download URL: pynut-1.3.3.tar.gz
- Upload date:
- Size: 66.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47b133e41b4bbbddcc1d7bc322dc4b1f9333766bc8e94b974bf0883a215459fe
|
|
| MD5 |
237c6c7afd235c97f0a328cbe5cf4abf
|
|
| BLAKE2b-256 |
615f9a273b20895c24cd8a07affdb0320c148267d522591a1a9f07290231eee8
|
File details
Details for the file pynut-1.3.3-py3-none-any.whl.
File metadata
- Download URL: pynut-1.3.3-py3-none-any.whl
- Upload date:
- Size: 65.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a4dcc7d9859516550d6918afff43161175995cacfc50514558664340a4c4911
|
|
| MD5 |
4c775d5a20217aa87fbb7f2de44b7a65
|
|
| BLAKE2b-256 |
e87578005583aa63eaf3665319ba5cd71c0fa5c574f4b04e45eed8c9cb136ea7
|