{"id":18985027,"url":"https://github.com/dobraczka/embarrassment","last_synced_at":"2026-05-15T17:42:24.163Z","repository":{"id":222133114,"uuid":"755025514","full_name":"dobraczka/embarrassment","owner":"dobraczka","description":" 🐼🐼🐼 Convenience functions to work with pandas triple dataframes","archived":false,"fork":false,"pushed_at":"2024-02-12T15:56:51.000Z","size":273,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-01T23:35:11.006Z","etag":null,"topics":["knowledge-graph","pandas","rdf","triples"],"latest_commit_sha":null,"homepage":"https://embarrassment.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dobraczka.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-09T09:26:40.000Z","updated_at":"2024-02-13T09:03:08.000Z","dependencies_parsed_at":"2024-11-08T16:26:50.681Z","dependency_job_id":"7a482efa-cfa6-4f9a-9432-fe36e99836f4","html_url":"https://github.com/dobraczka/embarrassment","commit_stats":null,"previous_names":["dobraczka/embarrassment"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dobraczka%2Fembarrassment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dobraczka%2Fembarrassment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dobraczka%2Fembarrassment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dobraczka%2Fembarrassment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dobraczka","download_url":"https://codeload.github.com/dobraczka/embarrassment/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239993961,"owners_count":19730779,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["knowledge-graph","pandas","rdf","triples"],"created_at":"2024-11-08T16:24:08.619Z","updated_at":"2025-11-10T17:03:36.875Z","avatar_url":"https://github.com/dobraczka.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/dobraczka/embarrassment/raw/main/docs/assets/logo.png\" alt=\"embarrassment logo\", width=200/\u003e\n\u003ch2 align=\"center\"\u003e embarrassment\u003c/h2\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/dobraczka/embarrassment/actions/workflows/main.yml\"\u003e\u003cimg alt=\"Actions Status\" src=\"https://github.com/dobraczka/embarrassment/actions/workflows/main.yml/badge.svg?branch=main\"\u003e\u003c/a\u003e\n\u003ca href='https://embarrassment.readthedocs.io/en/latest/?badge=latest'\u003e\u003cimg src='https://readthedocs.org/projects/embarrassment/badge/?version=latest' alt='Documentation Status' /\u003e\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/embarrassment\"/\u003e\u003cimg alt=\"Stable python versions\" src=\"https://img.shields.io/pypi/pyversions/embarrassment\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/psf/black\"\u003e\u003cimg alt=\"Code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nConvenience functions for pandas dataframes containing triples. Fun fact: a group of pandas (e.g. three) is commonly referred to as an [embarrassment](https://www.zmescience.com/feature-post/what-is-a-group-of-pandas-called-its-surprisingly-complicated/).\n\nThis library's main focus is to easily make commonly used functions available, when exploring [triples](https://en.wikipedia.org/wiki/Semantic_triple) stored in pandas dataframes. It is not meant to be an efficient graph analysis library.\n\nUsage\n=====\nYou can use a variety of convenience functions, let's create some simple example triples:\n```python\n\u003e\u003e\u003e import pandas as pd\n\u003e\u003e\u003e rel = pd.DataFrame([(\"e1\",\"rel1\",\"e2\"), (\"e3\", \"rel2\", \"e1\")], columns=[\"head\",\"relation\",\"tail\"])\n\u003e\u003e\u003e attr = pd.DataFrame([(\"e1\",\"attr1\",\"lorem ipsum\"), (\"e2\",\"attr2\",\"dolor\")], columns=[\"head\",\"relation\",\"tail\"])\n```\nSearch in attribute triples:\n```python\n\u003e\u003e\u003e from embarrassment import search\n\u003e\u003e\u003e search(attr, \"lorem ipsum\")\n  head relation         tail\n0   e1    attr1  lorem ipsum\n\u003e\u003e\u003e search(attr, \"lorem\", method=\"substring\")\n  head relation         tail\n0   e1    attr1  lorem ipsum\n```\nSelect triples with a specific relation:\n```python\n\u003e\u003e\u003e from embarrassment import select_rel\n\u003e\u003e\u003e select_rel(rel, \"rel1\")\n  head relation tail\n0   e1     rel1   e2\n```\nPerform operations on the immediate neighbor(s) of an entity, e.g. get the attribute triples:\n```python\n\u003e\u003e\u003e from embarrassment import neighbor_attr_triples\n\u003e\u003e\u003e neighbor_attr_triples(rel, attr, \"e1\")\n  head relation   tail\n1   e2    attr2  dolor\n```\nOr just get the triples:\n```python\n\u003e\u003e\u003e from embarrassment import neighbor_rel_triples\n\u003e\u003e\u003e neighbor_rel_triples(rel, \"e1\")\n  head relation tail\n1   e3     rel2   e1\n0   e1     rel1   e2\n```\nBy default you get in- and out-links, but you can specify a direction:\n```python\n\u003e\u003e\u003e neighbor_rel_triples(rel, \"e1\", in_out_both=\"in\")\n  head relation tail\n1   e3     rel2   e1\n\u003e\u003e\u003e neighbor_rel_triples(rel, \"e1\", in_out_both=\"out\")\n  head relation tail\n0   e1     rel1   e2\n```\n\nUsing pandas' [pipe](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.pipe.html) operator you can chain operations.\nLet's see a more elaborate example by loading a dataset from [sylloge](https://github.com/dobraczka/sylloge):\n\n```python\n\u003e\u003e\u003e from sylloge import MovieGraphBenchmark\n\u003e\u003e\u003e from embarrassment import clean, neighbor_attr_triples, search, select_rel\n\u003e\u003e\u003e ds = MovieGraphBenchmark()\n\u003e\u003e\u003e # clean attribute triples\n\u003e\u003e\u003e cleaned_attr = clean(ds.attr_triples_left)\n\u003e\u003e\u003e # find uri of James Tolkan\n\u003e\u003e\u003e jt = search(cleaned_attr, query=\"James Tolkan\")[\"head\"].iloc[0]\n\u003e\u003e\u003e # get neighbor triples\n\u003e\u003e\u003e # and select triples with title and show values\n\u003e\u003e\u003e title_rel = \"https://www.scads.de/movieBenchmark/ontology/title\"\n\u003e\u003e\u003e ds.rel_triples_left.pipe(\n        neighbor_attr_triples, attr_df=cleaned_attr, wanted_eid=jt\n    ).pipe(select_rel, rel=title_rel)[\"tail\"]\n    12234    A Nero Wolfe Mystery\n    12282           Door to Death\n    12440          Die Like a Dog\n    12461        The Next Witness\n    Name: tail, dtype: object\n```\n\n\nInstallation\n============\nYou can install `embarrassment` via pip:\n```\npip install embarrassment\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdobraczka%2Fembarrassment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdobraczka%2Fembarrassment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdobraczka%2Fembarrassment/lists"}