{"id":13510666,"url":"https://github.com/approximatelabs/sketch","last_synced_at":"2026-03-11T14:38:44.593Z","repository":{"id":51207072,"uuid":"513726207","full_name":"approximatelabs/sketch","owner":"approximatelabs","description":"AI code-writing assistant that understands data content","archived":false,"fork":false,"pushed_at":"2024-02-08T15:15:58.000Z","size":9421,"stargazers_count":2289,"open_issues_count":7,"forks_count":120,"subscribers_count":20,"default_branch":"main","last_synced_at":"2026-02-17T03:58:30.260Z","etag":null,"topics":["ai","codex","copilot","data","data-science","dataframe","datasketch","datasketches","df","ds","gpt3","lambdaprompt","pandas","python","sketches","tabular-data"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/approximatelabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-07-14T01:54:07.000Z","updated_at":"2026-02-06T16:11:29.000Z","dependencies_parsed_at":"2024-06-12T15:51:20.356Z","dependency_job_id":null,"html_url":"https://github.com/approximatelabs/sketch","commit_stats":{"total_commits":139,"total_committers":5,"mean_commits":27.8,"dds":0.03597122302158273,"last_synced_commit":"6953b25672ddfe0dd4f97a4462a87fe0c1972f77"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/approximatelabs/sketch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/approximatelabs%2Fsketch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/approximatelabs%2Fsketch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/approximatelabs%2Fsketch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/approximatelabs%2Fsketch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/approximatelabs","download_url":"https://codeload.github.com/approximatelabs/sketch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/approximatelabs%2Fsketch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30384138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T14:10:17.325Z","status":"ssl_error","status_checked_at":"2026-03-11T14:09:37.934Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["ai","codex","copilot","data","data-science","dataframe","datasketch","datasketches","df","ds","gpt3","lambdaprompt","pandas","python","sketches","tabular-data"],"created_at":"2024-08-01T02:01:48.964Z","updated_at":"2026-03-11T14:38:44.573Z","avatar_url":"https://github.com/approximatelabs.png","language":"Python","readme":"[![](https://dcbadge.vercel.app/api/server/kW9nBQErGe?compact=true\u0026style=flat)](https://discord.gg/kW9nBQErGe)\n\n# sketch\n\nSketch is an AI code-writing assistant for pandas users that understands the context of your data, greatly improving the relevance of suggestions. Sketch is usable in seconds and doesn't require adding a plugin to your IDE.\n\n```bash\npip install sketch\n```\n\n## Demo \n\nHere we follow a \"standard\" (hypothetical) data-analysis workflow, showing a Natural Language interface that successfully navigates many tasks in the data stack landscape. \n\n- Data Catalogging:\n  - General tagging (eg. PII identification)\n  - Metadata generation (names and descriptions)\n- Data Engineering:\n  - Data cleaning and masking (compliance)\n  - Derived feature creation and extraction\n- Data Analysis:\n  - Data questions\n  - Data visualization\n\nhttps://user-images.githubusercontent.com/916073/212602281-4ebd090f-09c4-495d-b48d-0b4c37b9f665.mp4\n\nTry it out in colab: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/gist/bluecoconut/410a979d94613ea2aaf29987cf0233bc/sketch-demo.ipynb)\n\n## How to use\n\nIt's as simple as importing sketch, and then using the `.sketch` extension on any pandas dataframe.\n\n```python\nimport sketch\n```\n\nNow, any pandas dataframe you have will have an extension registered to it. Access this new extension with your dataframes name `.sketch`\n\n### `.sketch.ask`\n\nAsk is a basic question-answer system on sketch, this will return an answer in text that is based off of the summary statistics and description of the data. \n\nUse ask to get an understanding of the data, get better column names, ask hypotheticals (how would I go about doing X with this data), and more.\n\n```python\ndf.sketch.ask(\"Which columns are integer type?\")\n```\n\n### `.sketch.howto`\n\nHowto is the basic \"code-writing\" prompt in sketch. This will return a code-block you should be able to copy paste and use as a starting point (or possibly ending!) for any question you have to ask of the data. Ask this how to clean the data, normalize, create new features, plot, and even build models!\n\n```python\ndf.sketch.howto(\"Plot the sales versus time\")\n```\n\n### `.sketch.apply`\n\napply is a more advanced prompt that is more useful for data generation. Use it to parse fields, generate new features, and more. This is built directly on [lambdaprompt](https://github.com/approximatelabs/lambdaprompt). In order to use this, you will need to set up a free account with OpenAI, and set an environment variable with your API key. `OPENAI_API_KEY=YOUR_API_KEY`\n\n```python\ndf['review_keywords'] = df.sketch.apply(\"Keywords for the review [{{ review_text }}] of product [{{ product_name }}] (comma separated):\")\n```\n\n```python\ndf['capitol'] = pd.DataFrame({'State': ['Colorado', 'Kansas', 'California', 'New York']}).sketch.apply(\"What is the capitol of [{{ State }}]?\")\n```\n\n## Sketch currently uses `prompts.approx.dev` to help run with minimal setup\n\nYou can also directly use a few pre-built hugging face models (right now `MPT-7B` and `StarCoder`), which will run entirely locally (once you download the model weights from HF).\nDo this by setting environment 3 variables:\n\n```python\nos.environ['LAMBDAPROMPT_BACKEND'] = 'StarCoder'\nos.environ['SKETCH_USE_REMOTE_LAMBDAPROMPT'] = 'False'\nos.environ['HF_ACCESS_TOKEN'] = 'your_hugging_face_token'\n```\n\nYou can also directly call OpenAI directly (and not use our endpoint) by using your own API key. To do this, set 2 environment variables.\n\n(1) `SKETCH_USE_REMOTE_LAMBDAPROMPT=False`\n(2) `OPENAI_API_KEY=YOUR_API_KEY`\n\n## How it works\n\nSketch uses efficient approximation algorithms (data sketches) to quickly summarize your data, and feed that information into language models. Right now it does this by summarizing the columns and writing these summary statistics as additional context to be used by the code-writing prompt. In the future we hope to feed these sketches directly into custom made \"data + language\" foundation models to get more accurate results.\n\n","funding_links":[],"categories":["Python","ai","排行榜 [2025-03-18]"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapproximatelabs%2Fsketch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapproximatelabs%2Fsketch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapproximatelabs%2Fsketch/lists"}