<jupyter_start><jupyter_text>![title](img/cover4.png) Copyright! This material is protected, please do not copy or distribute.    by:<NAME> ***Udemy course : Python Bootcamp for Data Science 2021 Numpy Pandas & Seaborn ***  8.4 Reading Microsoft Excel Files First we import pandas library:<jupyter_code>import pandas as pd<jupyter_output><empty_output><jupyter_text>We can read a dataframe from Ms excel file using the function **pd.read_excel()**:<jupyter_code>credit = pd.read_excel('data/credit.xlsx')<jupyter_output><empty_output><jupyter_text>Lets display the head of this dataframe using the function **head()**:<jupyter_code>credit.head()<jupyter_output><empty_output><jupyter_text>We can extract specific columns form a dataframe into a new dataframe like this:<jupyter_code>data = pd.DataFrame(credit, columns= (['Income', 'Limit']))
data.head()<jupyter_output><empty_output><jupyter_text>We can save this dataframe into an excel file named (example1.xlsx) using the function **to_excel()**:<jupyter_code>data.to_excel('data/example1.xlsx')<jupyter_output><empty_output><jupyter_text>We can list all files in the directory (data) using the function **listdir()**:<jupyter_code>from os import listdir
listdir('data')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11802232854864433, 'fraction_numerical': 0.007177033492822967, 'mean_word_length': 8.507575757575758, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '608195', 'license': 'MIT', 'n_tokens_mistral': 429, 'n_tokens_neox': 415, 'n_words': 108, 'path': '8.4 Reading Microsoft Excel Files.ipynb', 'repo_name': 'SiamakMushakhian/Numpy-Pandas-Seaborn', 'size': '1259'}