import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.randn(10, 4), columns=['A', 'B', 'C', 'D'])
df2 = pd.DataFrame(np.random.randn(7, 3), columns=['A', 'B', 'C'])
sum_df = df + df2
sum_df

"""
Explanation: NumPy Universal Functions
If the data within a DataFrame are numeric, NumPy's universal functions can be used on/with the DataFrame.
End of explanation
"""


np.exp(sum_df)

"""
Explanation: NaN are handled correctly by universal function
End of explanation
"""


sum_df.T

np.transpose(sum_df.values)

"""
Explanation: Transpose availabe T attribute
End of explanation
"""


A_df = pd.DataFrame(np.arange(15).reshape((3,5)))
B_df = pd.DataFrame(np.arange(10).reshape((5,2)))
A_df.dot(B_df)

"""
Explanation: dot method on DataFrame implements matrix multiplication
Note: row and column headers
End of explanation
"""


C_Series = pd.Series(np.arange(5,10))
C_Series.dot(C_Series)

"""
Explanation: dot method on Series implements dot product
End of explanation
"""


