{ "info": { "author": "Agustin Rodriguez", "author_email": "agustin.dev@protonmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "## From WhatsApp chats to pandas dataframe made easy\n\nWhatsParser is a tool for parsing `.txt` chat files rendered by the WhatsApp messaging App. Is intended to make the shift from WhatsApp data to pandas dataframe as rapid as possible. Reading and parsing the `.txt` file is done like this:\n\n```python\nfrom whatsparser import WhatsParser\n\nmessages = WhatsParser('./chat.txt')\n```\n\nOnce the file has been parsed, all messages are stored as dictionaries with three keys: _datetime_, _author_ and _content_. Using indexing you can access individual data point:\n\n```Python\nlen(messages) # Get how many messages there are\n>> 3590\n\nmessages[35] # Get a message\n>> {'datetime': datetime.datetime(2017, 9, 15, 19, 10, 2),\n 'author': 'Agustin Rodriguez',\n 'content': 'Hi! this is a Whatsapp message'}\n```\n\nThe datetime key stores a datetime object, all the others have string as values.\n\n### Pandas dataframe\n\nConvert all messages into a pandas DataFrame so you can use your favorite tools for data analysis:\n\n```Python\ndf = messages.to_dataframe() # Returns a pandas dataframe\n```\n\n## Looping\n\nWhatsParser also offer the possibility of iterate through the object using various functions. When iterating over `messages` a copy is made of all messages stored and iteration and changes occurs over this copy. It is possible to change the data store inside `messages` by assigning the results of the iteration to `messages.data`.\n\n### Filter messages\n\n```Python\ndef find_long_messages(message):\n if len(message['content']) > 100:\n return True\n return False\n\nmessages.data = list(filter(find_long_messages, messages))\n# Now, messages contains only those messages with a length greater than 100 characters.\n```\n\n### List comprehension\n\n```Python\nfrom emoji import get_emoji_regexp\n\ndef remove_emojis(message):\n message['content'] = get_emoji_regexp().sub(r'', message['content'])\n return message\n\nmessages.data = [remove_emojis(message) for message in messages]\n# All messages got their emojis remove from the text\n```\n\n### Map function\n\n```Python\ndef remove_emojis(message):\n message['content'] = get_emoji_regexp().sub(r'', message['content'])\n return message\n\nmessages.data = list(map(remove_emojis, messages))\n```\n\n### For loop\n\nIterate over `messages.data` to make changes on the fly, if no just use `messages`.\n\n```Python\n# For changing data\nfor message in messages.data:\n message['content'] = 'NEW CONTENT'\n\n# Without changing the data\nfor message in messages:\n print(message['author'])\n\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nonsignificantp/whatsparser", "keywords": "whatsapp,parser,text,dataframe", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "WhatsParser", "package_url": "https://pypi.org/project/WhatsParser/", "platform": "", "project_url": "https://pypi.org/project/WhatsParser/", "project_urls": { "Homepage": "https://github.com/nonsignificantp/whatsparser" }, "release_url": "https://pypi.org/project/WhatsParser/0.6.0/", "requires_dist": null, "requires_python": "", "summary": "A parser for whatsapp .txt files", "version": "0.6.0" }, "last_serial": 4518209, "releases": { "0.5.0": [ { "comment_text": "", "digests": { "md5": "81bc93fb3a51adf65578a19f2907b1ae", "sha256": "56fba97ebc862b0aa8fc4ed8144ccee1342c6ebf0cd5fac64e221f7bd69d9931" }, "downloads": -1, "filename": "WhatsParser-0.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "81bc93fb3a51adf65578a19f2907b1ae", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5931, "upload_time": "2018-11-22T19:52:31", "url": "https://files.pythonhosted.org/packages/8c/54/443ddadc9c6f15601a125164012a631009914189ebceec2ce11c1fb561c9/WhatsParser-0.5.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5c332d8e0fec0aac99d6b77e7e0a8d42", "sha256": "769bfa0b700473a1fcc4dacb1d2c6a6f7b763973b2e8bf63e01257939584e9f2" }, "downloads": -1, "filename": "WhatsParser-0.5.0.tar.gz", "has_sig": false, "md5_digest": "5c332d8e0fec0aac99d6b77e7e0a8d42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4330, "upload_time": "2018-11-22T19:52:33", "url": "https://files.pythonhosted.org/packages/2e/e2/cc7a037d0834c9296ee89531b4d69cc4d7708a4308ac67ab0740983676be/WhatsParser-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "8f983b0a3424149cee7040c94b32047f", "sha256": "69abddac26695136b3d2bdbaec28d54ea2b17e2a30e78206c7eb67830a1c941c" }, "downloads": -1, "filename": "WhatsParser-0.6.0-py3-none-any.whl", "has_sig": false, "md5_digest": "8f983b0a3424149cee7040c94b32047f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5927, "upload_time": "2018-11-22T20:12:44", "url": "https://files.pythonhosted.org/packages/08/95/5f378ede475a12a836b4e85ab42566223e72356865fb5a429a15f93a0d13/WhatsParser-0.6.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "35ea418fcacd79e32029fd082635af3f", "sha256": "b4436524423b27bb0ba89890435246f264c405bf611d4847f2978e81a38ae65e" }, "downloads": -1, "filename": "WhatsParser-0.6.0.tar.gz", "has_sig": false, "md5_digest": "35ea418fcacd79e32029fd082635af3f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4378, "upload_time": "2018-11-22T20:12:46", "url": "https://files.pythonhosted.org/packages/b5/84/6cca53ffd5038574aabc5e95f9de30373aa20c2323efe3791fc5e428248d/WhatsParser-0.6.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8f983b0a3424149cee7040c94b32047f", "sha256": "69abddac26695136b3d2bdbaec28d54ea2b17e2a30e78206c7eb67830a1c941c" }, "downloads": -1, "filename": "WhatsParser-0.6.0-py3-none-any.whl", "has_sig": false, "md5_digest": "8f983b0a3424149cee7040c94b32047f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5927, "upload_time": "2018-11-22T20:12:44", "url": "https://files.pythonhosted.org/packages/08/95/5f378ede475a12a836b4e85ab42566223e72356865fb5a429a15f93a0d13/WhatsParser-0.6.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "35ea418fcacd79e32029fd082635af3f", "sha256": "b4436524423b27bb0ba89890435246f264c405bf611d4847f2978e81a38ae65e" }, "downloads": -1, "filename": "WhatsParser-0.6.0.tar.gz", "has_sig": false, "md5_digest": "35ea418fcacd79e32029fd082635af3f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4378, "upload_time": "2018-11-22T20:12:46", "url": "https://files.pythonhosted.org/packages/b5/84/6cca53ffd5038574aabc5e95f9de30373aa20c2323efe3791fc5e428248d/WhatsParser-0.6.0.tar.gz" } ] }