{"id":28625323,"url":"https://github.com/marwan116/pandas-chained-logging","last_synced_at":"2026-04-28T00:33:01.120Z","repository":{"id":168378107,"uuid":"597904697","full_name":"marwan116/pandas-chained-logging","owner":"marwan116","description":"Stay true to pandas method chaining by using this logging accessor ","archived":false,"fork":false,"pushed_at":"2023-05-23T12:51:42.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-12T08:11:26.424Z","etag":null,"topics":["logging","pandas","python"],"latest_commit_sha":null,"homepage":"","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/marwan116.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null}},"created_at":"2023-02-06T00:35:22.000Z","updated_at":"2023-06-01T02:51:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"dbb3444d-6685-4497-a517-fb0afd463062","html_url":"https://github.com/marwan116/pandas-chained-logging","commit_stats":null,"previous_names":["marwan116/pandas-chained-logging"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marwan116/pandas-chained-logging","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan116%2Fpandas-chained-logging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan116%2Fpandas-chained-logging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan116%2Fpandas-chained-logging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan116%2Fpandas-chained-logging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marwan116","download_url":"https://codeload.github.com/marwan116/pandas-chained-logging/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwan116%2Fpandas-chained-logging/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32361477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["logging","pandas","python"],"created_at":"2025-06-12T08:10:16.815Z","updated_at":"2026-04-28T00:33:01.115Z","avatar_url":"https://github.com/marwan116.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pandas-chained-logging\nStay true to pandas method chaining by using this logging accessor \n\n## Installation\n```bash\npip install pandas-chained-logging\n```\n\n## Usage\n\nTo quickly get started use our `log` accessor with the message you want to log. This will print the message and return the dataframe.\n\n```python\nIn [1]: import pandas as pd\n   ...: import pandas_chained_logging\n   ...: \n   ...: df = pd.DataFrame({\"a\": [1, 2, 3], \"b\": [4, 5, 6]})\n   ...: \n   ...: (\n   ...:     df\n   ...:     .assign(c=lambda x: x.a + x.b)\n   ...:     .log(\"We can log and chain!\")\n   ...:     .assign(d=lambda x: x.a * x.b)\n   ...:     .log(\"We can log and chain again!\")\n   ...:     .log(\"We can get the new shape and dtypes by using a callable\")\n   ...:     .log(lambda df: f\"!\\n{df.shape=}\\n{df.dtypes=}\")\n   ...: )\nWe can log and chain!\nWe can log and chain again!\nWe can get the new shape and dtypes by using a callable\n!\ndf.shape=(3, 4)\ndf.dtypes=a    int64\nb    int64\nc    int64\nd    int64\ndtype: object\nOut[1]: \n   a  b  c   d\n0  1  4  5   4\n1  2  5  7  10\n2  3  6  9  18\n```\n\nTo use a logger instead of `print` you can configure the logger with the `configure_logger` function.\n\n```python\nIn [1]: import logging\n   ...: import pandas as pd\n   ...: import pandas_chained_logging\n   ...: \n   ...: logger = logging.getLogger(\"my_logger\")\n   ...: sh = logging.StreamHandler()\n   ...: formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n   ...: sh.setFormatter(formatter)\n   ...: logger.addHandler(sh)\n   ...: logger.setLevel(\"INFO\")\n   ...: pandas_chained_logging.configure_logger(logger)\n   ...: \n   ...: df = pd.DataFrame({\"a\": [1, 2, 3], \"b\": [4, 5, 6]})\n   ...: \n   ...: (\n   ...:     df\n   ...:     .assign(c=lambda x: x.a + x.b)\n   ...:     .log(\"We can log and chain!\")\n   ...:     .assign(d=lambda x: x.a * x.b)\n   ...:     .log(\"We can log and chain again!\")\n   ...:     .log(\"We can get the new shape and dtypes by using a callable\")\n   ...:     .log(lambda df: f\"!\\n{df.shape=}\\n{df.dtypes=}\")\n   ...: )\n2023-05-23 08:45:28,923 - my_logger - INFO - We can log and chain!\n2023-05-23 08:45:28,925 - my_logger - INFO - We can log and chain again!\n2023-05-23 08:45:28,925 - my_logger - INFO - We can get the new shape and dtypes by using a callable\n2023-05-23 08:45:28,925 - my_logger - INFO - !\ndf.shape=(3, 4)\ndf.dtypes=a    int64\nb    int64\nc    int64\nd    int64\ndtype: object\nOut[1]: \n   a  b  c   d\n0  1  4  5   4\n1  2  5  7  10\n2  3  6  9  18\n```\n\nYou can also pass your `logger` to the `log` accessor.\n\n```python\nIn [1]: import logging\n   ...: import pandas as pd\n   ...: import pandas_chained_logging\n   ...: \n   ...: logger = logging.getLogger(\"my_logger\")\n   ...: sh = logging.StreamHandler()\n   ...: formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n   ...: sh.setFormatter(formatter)\n   ...: logger.addHandler(sh)\n   ...: logger.setLevel(\"INFO\")\n   ...: \n   ...: df = pd.DataFrame({\"a\": [1, 2, 3], \"b\": [4, 5, 6]})\n   ...: \n   ...: (\n   ...:     df\n   ...:     .assign(c=lambda x: x.a + x.b)\n   ...:     .log(\"We can log and chain!\", logger=logger)\n   ...:     .assign(d=lambda x: x.a * x.b)\n   ...:     .log(\"We can log and chain again!\", logger=logger)\n   ...:     .log(\"We can get the new shape and dtypes by using a callable\")\n   ...:     .log(lambda df: f\"!\\n{df.shape=}\\n{df.dtypes=}\", logger=logger)\n   ...: )\n2023-05-23 08:46:46,391 - my_logger - INFO - We can log and chain!\n2023-05-23 08:46:46,393 - my_logger - INFO - We can log and chain again!\nWe can get the new shape and dtypes by using a callable\n2023-05-23 08:46:46,394 - my_logger - INFO - !\ndf.shape=(3, 4)\ndf.dtypes=a    int64\nb    int64\nc    int64\nd    int64\ndtype: object\nOut[1]: \n   a  b  c   d\n0  1  4  5   4\n1  2  5  7  10\n2  3  6  9  18\n```\n\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarwan116%2Fpandas-chained-logging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarwan116%2Fpandas-chained-logging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarwan116%2Fpandas-chained-logging/lists"}