Created
December 2, 2020 09:06
-
-
Save sherlockhomeless/80be5aff99d6d3933574ea012d8cec05 to your computer and use it in GitHub Desktop.
Delete Columns/Rows from Excel Sheet in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import pandas as pd | |
excel_file_path = 'modify.xlsx' | |
def read_excel(path: str): | |
return pd.read_excel(path) | |
e = read_excel(excel_file_path) | |
print(f'##### BEFORE #####\n\n {e} \n\n\n') | |
# delete column | |
del (e[0]) | |
# delete row | |
e = e.drop(index=0) | |
print(f'##### AFTER #####\n\n {e}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment