Your package description here
Project description
counttypes
Count types in a list - int, float, str, bool, list, set, dict, tuple
Example
from countertypes import counterTypes
data = [1, 2.2, 'hello', [1, 2], {'a': 1}, 9, 18, {'a': 4}, {'a': 1}, [1, 15, 0, 8], (1, 8), 9, (89, 9), False, True]
counter = counterTypes(data)
# check non zero datatype present inside list
print(counter.NonZeroTotal())
# sum of all datatype
print(counter.listSum('bool'))
# get a list of all datatypes
print(counter.lstOfBool)
# get a max datatype
print(counter.getMaxDataType())
# get a min datatype
print(counter.getMinDataType())
# get all datatypes count in dict form
print(counter.getCount())
# get all datatype list, in dict form
print(counter.get())
# sum of all (int, float, bool) list
print(counter.sumOfNumeric())
# get all (int, float, bool, string) in string form, inside a dict
print(counter.stringifyAll())
# get seccond to finish, the program
a1 = counterTypes.start()
print(counterTypes.end(a1))
# get a particular object convert into string
print(counter.stringFy())
# convert a object into JSON formate
JSON_Text = counter.JSON()
print(JSON_Text)
# Convert a JSON formate into Python Code
print(counterTypes.UnJSON(JSON_Text))
statusOne = "`('Hi', 'I', 'am', 'Suresh')`"
print(counterTypes.UnJSON(statusOne))
# compare each element inside 2 list with same len
value1 = counter.lstOfInt
lst = [1, 4, 5, 4.5]
print(counterTypes.compareEachElement(value1, lst))
# reversing a list, when reverse=True
print(counter.reverse())
lst = ['1.2', '3', '9.0', '10', 'suresh', '18', 'Bool', 'True']
counter1 = counterTypes(lst)
# convert a string into (int or float), if data in numeric form.
counterOneData = counter1.numeriFy()
print(counterOneData)
counterTwoData = counterTypes(counterOneData)
# convert a string to "bool", by default value is "True" and "False".
# use can set a key to convert a real data into bool value if key is exist inside list
print(counterTwoData.booliFy(condition=True, FalseKey=3))
# get value in order (int, float, bool, string, list, tuple, set, dict). if key=flase
# if key=True, then you can get a list carring a dict of all datatype list value. like get()
print(counterTwoData.formatic(key=True))
# find a value inside a list
print(counterTwoData.find(key=0))
# get a count of value inside list
print(counterTwoData.count(key=3))
# replace a old element with new element
print(counterTwoData.replace(re=3, key=10))
# remove a element if exist
print(counterTwoData.remove(key=3))
lst = [[1,2, [3, 4], [10, 1], [10, [0, 9], [0, 8]], [90]]]
counterThreeData = counterTypes(lst)
# convert a nested list into a single list form
print(counterThreeData.oneList())
# divide a list into a pair
print(counterTwoData.chunks(pair=3))
# get a list of table, by default it gives for table 2, but change table using "key=table" and set "end=On"
print(counterTypes.TableList(key=40, end=19))
# printing table, in table formate "2 x 1 = 2", no need to use print, set "key" and "end"
counterTypes.Table()
# find a element location
# nested_data = [[1, 2], [4, 5, [6, [7], 8]]]
nested_data = [{'name' : 'suresh', 'no' : 9820646838},[1, 0, (22, 8), 0], 7]
target_value = 'name'
counter = counterTypes(nested_data)
location = counter.find_location(target_value)
if location:
print(f"Value {target_value} found at path: {location}")
else:
print(f"Value {target_value} not found.")
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
countertype_sp-0.1.6.tar.gz
(6.9 kB
view details)
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 countertype_sp-0.1.6.tar.gz.
File metadata
- Download URL: countertype_sp-0.1.6.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6193314b6cc45cfb9e89e80148e8d283fa73876cd103d46a157f3e92ea67cf99
|
|
| MD5 |
625d6fe595054839c8d2fc77e2ef61d5
|
|
| BLAKE2b-256 |
0f39166301abcd8c1a8ff74051d6c21851bc1b3538aa38dd338f04b3010c7e63
|
File details
Details for the file countertype_sp-0.1.6-py3-none-any.whl.
File metadata
- Download URL: countertype_sp-0.1.6-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f465cfa41ca5bc03f63ea2ce1ec8a771c92ce7001b2a8eedcc16aede55fdb8bc
|
|
| MD5 |
30ac5cfcad8ae22f17eb3310ad0c87a2
|
|
| BLAKE2b-256 |
5111d3d3363dfdfae1c626bbfce5dce4b451eacc8f33fbadf7569132593f5202
|