# -*- coding: utf-8 -*-
"""
Created on Wed Nov 7 22:03:33 2018
@author: fengjuan
"""
import pandas as pd
import numpy as np
from numpy import nan as NaN
import re
import matplotlib as mpl
import matplotlib.pyplot as plt
from pandas import Series,DataFrame
'''arr=np.arange(12).reshape((3,4))
print(arr)
print(arr[0])
print(arr-arr[0])
frame=DataFrame(np.arange(12).reshape((4,3)),columns=list('bde'),
index=['Utah','Ohio','Texas','Oregon'])
Series=frame.ix[0]
print(frame)
print(Series)
print(frame-Series)
#Series2=Series(range(3),index=['b','e','f'])
#print(frame+Series2)
series3=frame['d']
print(series3)
print(frame.sub(series3,axis=0))'''
frame=DataFrame(np.random.randn(4,3),columns=list('bde'),
index=['Utah','Ohio','Texas','Oregon'])
print(frame)
frame1=np.abs(frame)
print(frame1)
f=lambda x:x.max()-x.min()
frame3=frame.apply(f)
print(frame3)