Working with Excel files in Python by Clinton W. Brownley

Working with Excel files in Python by Clinton W. Brownley

Author:Clinton W. Brownley
Language: eng
Format: epub
Publisher: O'Reilly Media, Inc.
Published: 2018-09-25T16:00:00+00:00


python 8excel_column_by_name.py sales_2013.xlsx output_files\8output.xls

You can then open the output file, 8output.xls, to review the results.

Pandas

To select specific columns based on column headings with pandas, you can list the names of the columns, as strings, inside square brackets after the name of the DataFrame. Alternatively, you can use the loc function. Again, if you use the loc function, then you need to add a colon and a comma before the list of column headings to indicate that you want to retain all of the rows for these columns.

To select columns based on column headings with pandas, type the following code into a text editor and save the file as pandas_column_by_name.py:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.