lamindb.dev.LabelManager#
- class lamindb.dev.LabelManager(host)#
Bases:
object
Label manager (
labels
).This allows to manage untyped labels
ULabel
and arbitrary typed labels (e.g.,CellLine
) and associate labels with features.See
Data
for more information.Attributes
Methods
- add(records, feature=None)#
Add one or several labels and associate them with a feature.
- add_from(data)#
Transfer labels from a file or dataset.
Examples
>>> file1 = ln.File(pd.DataFrame(index=[0, 1])) >>> file1.save() >>> file2 = ln.File(pd.DataFrame(index=[2, 3])) >>> file2.save() >>> ulabels = ln.ULabel.from_values(["Label1", "Label2"], field="name") >>> ln.save(ulabels) >>> labels = ln.ULabel.filter(name__icontains = "label").all() >>> file1.ulabels.set(labels) >>> file2.labels.add_from(file1)
- get(feature, mute=False, flat_names=False)#
Get labels given a feature.