pastebin

Paste Search Dynamic
Recent pastes
DataFrame
  1. import pandas as pd
  2. import numpy as np
  3.  
  4. # Create a sample dataframe
  5. df = pd.DataFrame({'X':[78,85,96,80,86], 'Y':[84,94,89,83,86],'Z':[86,97,96,72,83]})
  6.  
  7. # Raise the elements of the dataframe to the powers from the second array
  8. powers = np.array([2, 3, 4, 5, 6])
  9. result = np.power(df, powers[:,none])
  10. print(result
Parsed in 0.009 seconds