コード例 #1
0
df.to_excel('Lesson3.xlsx', index=False)

# Location of file
Location = r'C:\Users\hdrojas\.xy\startups\Lesson3.xlsx'

# Create ExcelFile object
xlsx = ExcelFile(Location)

# Parse a specific sheet
df = xlsx.parse('sheet1',index_col='StatusDate')
df.dtypes
#list index
df.index

#convert to upper
df.Names = df.Names.apply(lambda x: x.upper())
# Only grab where Status == 1
df = df[df['Status'] == 1]

#- For all records in the State column where they are equal to NJ, replace them with NY.
df.Names[df.Names == 'BOB'] = 'Chet' 
df.Names[df.Names == 'Chet'] = 'John'
df.Names[df.Names == 'MARY'] = 'John'

#agg by Names to get Sum
Daily = df.reset_index().groupby(['Names']).sum()
Daily.head()


data = [1000,2000,3000]
idx = date_range(start='12/31/2011', end='12/31/2013', freq='A')