LabelMap
Generate label maps for ML/DL Projects
Usage
-
With CSV file
from labelmap import LabelMap label_map = LabelMap(labels_csv="path-to-csv", labels_col_name="labels") label_map.info() # print label map
-
With CSV file and exclude some labels
from labelmap import LabelMap label_map = LabelMap(labels_csv="path-to-csv", labels_col_name="labels", exclude_labels=["cat", "dog"]) label_map.info() # print label map
-
Without CSV file
from labelmap import LabelMap label_map = LabelMap() label_map.add("cat") label_map.add("dog") label_map.info() # print label map
Parameters in LabelMap class
labels_csv:str- The path to the csv file containing the labels and ids.
- Not Required, default =
None
labels_col_name:str- The name of the column containing the labels.
- Required if
labels_col_nameis set, default =None
ids_col_name:str- The name of the column containing the ids.
- Not Required, default =
None
id_type:int/float- The type of the ids.
- Not Required, default =
int
exclude_labels:list- The labels to exclude from the label map.
- Not Required, default =
None
Methods in LabelMap class
-
add(label)- Add a label to the label map.
- Args:
label -> str - Return Type:
None
-
force_get(label)- Get the id of a label or if id not found then add the label and get.
- Args:
label -> str - Return Type:
None
-
to_text(id)- Get the label of an id.
- Args:
id -> int/ float - Return Type:
str
-
to_id(label)- Get the id of a label.
- Args:
label -> str - Return Type:
int/ float
-
map()- Get the label map as dict.
- Args:
None - Return Type:
dict
-
labels()- Get the list of labels.
- Args:
None - Return Type:
list
-
info()- Print the label map as table.
- Args:
None - Return Type:
None
-
count()- Get the number of labels.
- Args:
None' - Return Type:
int
-
as_dataframe()- Label data dictionary to pandas dataframe.
- Args:
None - Return Type:
pandas.DataFrame
-
save_csv(path)- label data dictionary save to csv file.
- Args:
path -> str - Return Type:
None
Metadata
Release files for labelmap 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| labelmap-0.0.1.tar.gz | 4.4 kB | Without provenance | Details for labelmap-0.0.1.tar.gz |
Release files / labelmap-0.0.1.tar.gz
| Download URL | labelmap-0.0.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f0a7025c28b4b7b5c6f4aa61d4630edb2975f59e24ca81743f8fed5aebc9bab
|
|
BLAKE2b-256 checksum How to use checksums |
9c18d67a340c5df2bc157862e90a7aeffd3918d9b9ba925c56ec1f7fa59f5f6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2
|
Security for labelmap 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.