From 5169f5c218ad7885dcbc740df7667d424b82beca Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 17 Jan 2021 16:26:07 -0500 Subject: [PATCH 1/3] Includes the reading from Excel example as suggested via #38990 --- .../comparison_with_spreadsheets.rst | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst b/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst index 13029173b2e65..aecd90a071129 100644 --- a/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst +++ b/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst @@ -89,13 +89,6 @@ Both `Excel ` can import data from various sources in various formats. -Excel files -''''''''''' - -Excel opens `various Excel file formats `_ -by double-clicking them, or using `the Open menu `_. -In pandas, you use :ref:`special methods for reading and writing from/to Excel files `. - CSV ''' @@ -125,6 +118,27 @@ would be: # alternatively, read_table is an alias to read_csv with tab delimiter tips = pd.read_table("tips.csv", header=None) +Excel files +''''''''''' + +Excel opens `various Excel file formats `_ +by double-clicking them, or using `the Open menu `_. +In pandas, you use :ref:`special methods for reading and writing from/to Excel files `. + +Let's first :ref:`create a new Excel file ` based on the ``tips`` dataframe in the above example: + +.. code-block:: python + + tips.to_excel("./tips.xlsx") + +Should you wish to subsequently access the data in the ``tips.xlsx`` file, you can read it into your module using + +.. code-block:: python + + tips_df = read_excel("./tips.xlsx", header=None) + +You have just read in an Excel file using pandas! + Limiting output ~~~~~~~~~~~~~~~ From 7037920d1307fa77fe48836260627f15a3124f90 Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 17 Jan 2021 17:01:07 -0500 Subject: [PATCH 2/3] Updated Comparison to Excel documentation with examples of reading Excel file, and fixed typo via #38990 --- .../getting_started/comparison/comparison_with_spreadsheets.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst b/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst index aecd90a071129..7f864ce80fe4e 100644 --- a/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst +++ b/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst @@ -135,7 +135,7 @@ Should you wish to subsequently access the data in the ``tips.xlsx`` file, you c .. code-block:: python - tips_df = read_excel("./tips.xlsx", header=None) + tips_df = pd.read_excel("./tips.xlsx", header=None) You have just read in an Excel file using pandas! From d8df1fc6d5d0b773e4687b04b1543b3c01df40b5 Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Thu, 21 Jan 2021 12:37:50 -0500 Subject: [PATCH 3/3] Update doc/source/getting_started/comparison/comparison_with_spreadsheets.rst Co-authored-by: Aidan Feldman --- .../getting_started/comparison/comparison_with_spreadsheets.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst b/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst index 7f864ce80fe4e..55f999c099e23 100644 --- a/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst +++ b/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst @@ -135,7 +135,7 @@ Should you wish to subsequently access the data in the ``tips.xlsx`` file, you c .. code-block:: python - tips_df = pd.read_excel("./tips.xlsx", header=None) + tips_df = pd.read_excel("./tips.xlsx", index_col=0) You have just read in an Excel file using pandas!