A small example package
Project description
Title
Subtitle
Objective: To make have some fun, and maybe can make data life more easy a bit Some basic Python commands are:
Input [1]:
from morris_lee_package import morris_coding as m
df =m.get_df()
df
Output [1]:
+----+--------+--------+----------+--------+
| | col1 | col2 | col3 | col4 |
+====+========+========+==========+========+
| 0 | 1 | 3 | dog | 9 |
+----+--------+--------+----------+--------+
| 1 | 2 | 4 | | 8 |
+----+--------+--------+----------+--------+
| 2 | 3 | 5 | dog | nan |
+----+--------+--------+----------+--------+
| 3 | 4 | 6 | elephant | 6 |
+----+--------+--------+----------+--------+
| 4 | 5 | 7 | dragon | 5 |
+----+--------+--------+----------+--------+
Input [2]:
# To identify whether there is any null values:
m.null(df,'df')
# To easy print dimension of a dataframe
m.shape(df, 'df')
Output [2]:
STATUS: There is null value in dataframe
STATUS: Nulls of df = {'col3': '1 (20.0%)', 'col4': '1 (20.0%)'} of total 5
STATUS: Dimension of "df" = (5, 4)
Input [3]:
# To identify whether there is any duplicate values in a column:
m.duplicate(df, 'col3')
Output [3]:
STATUS: There are 1 duplicate values in the column of "col3"
Input [4]:
# To easy print value counts of a column, including also percentage:
m.vc(df, 'col3')
Output [4]:
+----------+---------+------------------+
| col3 | count | percentage (%) |
+==========+=========+==================+
| dog | 2 | 50 |
+----------+---------+------------------+
| dragon | 1 | 25 |
+----------+---------+------------------+
| elephant | 1 | 25 |
+----------+---------+------------------+
Input [5]:
# To easy drop a column:
m.drop(df, 'col3')
Output [5]:
+----+--------+--------+--------+
| | col1 | col2 | col4 |
+====+========+========+========+
| 0 | 1 | 3 | 9 |
+----+--------+--------+--------+
| 1 | 2 | 4 | 8 |
+----+--------+--------+--------+
| 2 | 3 | 5 | nan |
+----+--------+--------+--------+
| 3 | 4 | 6 | 6 |
+----+--------+--------+--------+
| 4 | 5 | 7 | 5 |
+----+--------+--------+--------+
Input [6]:
# To easy one_hot_encode a column:
m.one_hot_encode(df, 'col3')
Output [6]:
+----+--------+--------+--------+-------+----------+------------+
| | col1 | col2 | col4 | dog | dragon | elephant |
+====+========+========+========+=======+==========+============+
| 0 | 1 | 3 | 9 | 1 | 0 | 0 |
+----+--------+--------+--------+-------+----------+------------+
| 1 | 2 | 4 | 8 | 0 | 0 | 0 |
+----+--------+--------+--------+-------+----------+------------+
| 2 | 3 | 5 | nan | 1 | 0 | 0 |
+----+--------+--------+--------+-------+----------+------------+
| 3 | 4 | 6 | 6 | 0 | 0 | 1 |
+----+--------+--------+--------+-------+----------+------------+
| 4 | 5 | 7 | 5 | 0 | 1 | 0 |
+----+--------+--------+--------+-------+----------+------------+
This is contributed by Morris Lee.
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
morris-learning-0.0.2.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file morris-learning-0.0.2.tar.gz
.
File metadata
- Download URL: morris-learning-0.0.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfc9e6ae82ee14ceb3715a00ffd3b1d32e55491d6f3e8f44f367c94a909235b7 |
|
MD5 | bd87fd5bba51f66ffead2827583c3ae8 |
|
BLAKE2b-256 | 43fa9d07a1a24f7424503873dc2fcab5c2429ac48a13a391de023347decca74b |
File details
Details for the file morris_learning-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: morris_learning-0.0.2-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 289b4407a7585220dcc88bcd3b2f60b20eac498c6e93a07cec4a812ce637f592 |
|
MD5 | 13a1a9e7a14df0fd6daf1cbdd6d7271d |
|
BLAKE2b-256 | f59a3fddf4ef796ff5df1ecedb91a67cbd8da1b98dea26ac6b6073d2c7d65847 |