## Quickly edit Pandas DataFrames and Series in Excel
Use this methods to quickly edit your DataFrame with MS Excel.
Of course, Pandas is a lot better than Excel, but if you have to change a lot of arbitrary values which don't have a clear pattern, a GUI is imho the best choice.
```python
pip install a-pandas-ex-excel-edit
```
```python
#Here is an example:
import pandas as pd
from a_pandas_ex_excel_edit import pd_add_excel_editor
#pd_add_excel_editor will add 2 new methods:
#pandas.Series.s_edit_in_excel
#pandas.DataFrame.d_edit_in_excel
pd_add_excel_editor()
dframe = pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv")
#Let's add a row with lists, a tough data type to handle
dframe['list_in_columns'] = [[[1]*10]] * len(dframe)
PassengerId Survived ... Embarked list_in_columns
0 1 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
1 2 1 ... C [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
2 3 1 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
3 4 1 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
4 5 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
.. ... ... ... ... ...
886 887 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
887 888 1 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
888 889 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
889 890 1 ... C [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
890 891 0 ... Q [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
[891 rows x 13 columns]
dframe.dtypes
Out[6]:
PassengerId int64
Survived int64
Pclass int64
Name object
Sex object
Age float64
SibSp int64
Parch int64
Ticket object
Fare float64
Cabin object
Embarked object
list_in_columns object
dtype: object
df = dframe.d_edit_in_excel() #DataFrames
Out[7]:
PassengerId Survived ... Embarked list_in_columns
0 10001 9999 ... NOT YET [[1, 99999, 1, 1, 1, 1, 1, 1, 1, 1]]
1 10000 1 ... C [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
2 9999 1 ... NOT YET [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
3 9998 1 ... NOT YET [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
4 9997 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
.. ... ... ... ... ...
886 887 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
887 888 1 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
888 889 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
889 890 1 ... C [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
890 891 0 ... Q [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
[891 rows x 13 columns]
df.dtypes
Out[9]:
PassengerId uint16
Survived uint16
Pclass uint8
Name string
Sex category
Age object
SibSp uint8
Parch uint8
Ticket object
Fare float64
Cabin category
Embarked category
list_in_columns object #you can even edit lists, dicts and tuples with Excel!
dtype: object
df2 = dframe.Name.s_edit_in_excel() #Series
df2
Out[8]:
0 HANNIBAL LECTOR
1 Cumings, Mrs. John Bradley (Florence Briggs Th...
2 Heikkinen, Miss. Laina
3 Futrelle, Mrs. Jacques Heath (Lily May Peel)
4 Allen, Mr. William Henry
...
886 Montvila, Rev. Juozas
887 Graham, Miss. Margaret Edith
888 Johnston, Miss. Catherine Helen "Carrie"
889 Behr, Mr. Karl Howell
890 Dooley, Mr. Patrick
Name: Name, Length: 891, dtype: string
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/a_pandas_ex_excel_edit",
"name": "a-pandas-ex-excel-edit",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "pandas,excel,MS Excel,quick,edit",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0b/28/4ebb6f6c405412751f2d1f72b7b06b5ab4cb120b405201670bc5fe7aac5b/a_pandas_ex_excel_edit-0.11.tar.gz",
"platform": null,
"description": "\r\n## Quickly edit Pandas DataFrames and Series in Excel\r\n\r\nUse this methods to quickly edit your DataFrame with MS Excel. \r\nOf course, Pandas is a lot better than Excel, but if you have to change a lot of arbitrary values which don't have a clear pattern, a GUI is imho the best choice.\r\n\r\n```python\r\npip install a-pandas-ex-excel-edit \r\n```\r\n\r\n```python\r\n #Here is an example:\r\n\r\n import pandas as pd\r\n from a_pandas_ex_excel_edit import pd_add_excel_editor \r\n\r\n #pd_add_excel_editor will add 2 new methods: \r\n #pandas.Series.s_edit_in_excel\r\n #pandas.DataFrame.d_edit_in_excel\r\n pd_add_excel_editor() \r\n\r\n dframe = pd.read_csv(\"https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv\")\r\n #Let's add a row with lists, a tough data type to handle\r\n dframe['list_in_columns'] = [[[1]*10]] * len(dframe) \r\n\r\n PassengerId Survived ... Embarked list_in_columns\r\n0 1 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n1 2 1 ... C [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n2 3 1 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n3 4 1 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n4 5 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n.. ... ... ... ... ...\r\n886 887 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n887 888 1 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n888 889 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n889 890 1 ... C [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n890 891 0 ... Q [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n[891 rows x 13 columns] \r\n\r\ndframe.dtypes\r\nOut[6]: \r\nPassengerId int64\r\nSurvived int64\r\nPclass int64\r\nName object\r\nSex object\r\nAge float64\r\nSibSp int64\r\nParch int64\r\nTicket object\r\nFare float64\r\nCabin object\r\nEmbarked object\r\nlist_in_columns object\r\ndtype: object \r\n\r\ndf = dframe.d_edit_in_excel() #DataFrames \r\n\r\nOut[7]: \r\n PassengerId Survived ... Embarked list_in_columns\r\n0 10001 9999 ... NOT YET [[1, 99999, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n1 10000 1 ... C [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n2 9999 1 ... NOT YET [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n3 9998 1 ... NOT YET [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n4 9997 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n.. ... ... ... ... ...\r\n886 887 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n887 888 1 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n888 889 0 ... S [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n889 890 1 ... C [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n890 891 0 ... Q [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]\r\n[891 rows x 13 columns]\r\n\r\n df.dtypes\r\nOut[9]: \r\nPassengerId uint16\r\nSurvived uint16\r\nPclass uint8\r\nName string\r\nSex category\r\nAge object\r\nSibSp uint8\r\nParch uint8\r\nTicket object\r\nFare float64\r\nCabin category\r\nEmbarked category\r\nlist_in_columns object #you can even edit lists, dicts and tuples with Excel!\r\ndtype: object \r\n\r\ndf2 = dframe.Name.s_edit_in_excel() #Series\r\n\r\ndf2\r\nOut[8]: \r\n0 HANNIBAL LECTOR\r\n1 Cumings, Mrs. John Bradley (Florence Briggs Th...\r\n2 Heikkinen, Miss. Laina\r\n3 Futrelle, Mrs. Jacques Heath (Lily May Peel)\r\n4 Allen, Mr. William Henry\r\n ... \r\n886 Montvila, Rev. Juozas\r\n887 Graham, Miss. Margaret Edith\r\n888 Johnston, Miss. Catherine Helen \"Carrie\"\r\n889 Behr, Mr. Karl Howell\r\n890 Dooley, Mr. Patrick\r\nName: Name, Length: 891, dtype: string \r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "If you have to change a lot of arbitrary values which don't have a clear pattern, use Excel!",
"version": "0.11",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/a_pandas_ex_excel_edit"
},
"split_keywords": [
"pandas",
"excel",
"ms excel",
"quick",
"edit"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1e231d2c355e40ae526a4ad089e6c47eb50ed650c69ec5eb35356a1ded509b6f",
"md5": "159c150c6c51ba0122d724d018a916fc",
"sha256": "34cfab0d0d60e096fdd9629672f5a85bfe3ec28df9322100b7fe425f910a9e30"
},
"downloads": -1,
"filename": "a_pandas_ex_excel_edit-0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "159c150c6c51ba0122d724d018a916fc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8286,
"upload_time": "2023-07-06T00:09:15",
"upload_time_iso_8601": "2023-07-06T00:09:15.871624Z",
"url": "https://files.pythonhosted.org/packages/1e/23/1d2c355e40ae526a4ad089e6c47eb50ed650c69ec5eb35356a1ded509b6f/a_pandas_ex_excel_edit-0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0b284ebb6f6c405412751f2d1f72b7b06b5ab4cb120b405201670bc5fe7aac5b",
"md5": "32443dc1f9bcf84f41f4ff8ae3797478",
"sha256": "a8e0c9d347ffed41ab32cac7e49275ced8afa2e98b5c5e476e8989231f9b79df"
},
"downloads": -1,
"filename": "a_pandas_ex_excel_edit-0.11.tar.gz",
"has_sig": false,
"md5_digest": "32443dc1f9bcf84f41f4ff8ae3797478",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6252,
"upload_time": "2023-07-06T00:09:17",
"upload_time_iso_8601": "2023-07-06T00:09:17.615299Z",
"url": "https://files.pythonhosted.org/packages/0b/28/4ebb6f6c405412751f2d1f72b7b06b5ab4cb120b405201670bc5fe7aac5b/a_pandas_ex_excel_edit-0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-06 00:09:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "a_pandas_ex_excel_edit",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "a-pandas-ex-excel-edit"
}