How to Add a Numpy Array to a Pandas DataFrame - Statology
https://www.statology.org/add-numpy-array-to-pandas-dataframe01.12.2020 · import numpy as np import pandas as pd #create pandas DataFrame df = pd.DataFrame({' points ': [25, 12, 15, 14, 19, 23, 25, 29], ' assists ': [5, 7, 7, 9, 12, 9, 9, 4], ' rebounds ': [11, 8, 10, 6, 6, 5, 9, 12]}) #create NumPy array for 'blocks' blocks = np. array ([2, 3, 1, 0, 2, 7, 8, 2]) #add 'blocks' array as new column in DataFrame df[' blocks '] = blocks. tolist () #display the …