In [1]:html
import pandas as pd import sys
print('Python version ' + sys.version) print('Pandas version ' + pd.__version__)
Python version 3.5.1 |Anaconda custom (64-bit)| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)]
Pandas version 0.20.1
# Create DataFrame
d = [1,2,3,4,5,6,7,8,9] df = pd.DataFrame(d, columns = ['Number']) df
# Export to Excel
df.to_excel('Lesson10.xlsx', sheet_name = 'testing', index = False) print('Done')
# Path to excel file
# Your path will be different, please modify the path below. location = r'C:\Users\david\notebooks\update\Lesson10.xlsx' # Parse the excel file df = pd.read_excel(location, 0) df.head()
df.dtypes
df.tail()
df.to_json('Lesson10.json') print('Done')
Done
# Your path will be different, please modify the path below.
jsonloc = r'C:\Users\david\notebooks\update\Lesson10.json' # read json file df2 = pd.read_json(jsonloc)
df2
df2.dtypes
This tutorial was rewrited by CDSpython