pd dataframe from array code example
Example 1: dataframe from arrays python
import pandas as pd
df=pd.DataFrame({'col1':vect1,'col2':vect2})
Example 2: converting numpy array to dataframe
import numpy as np
import pandas as pd
>>> data = np.array([[5.8, 2.8], [6.0, 2.2]])
>>> print(data)
>>> data
array([[5.8, 2.8],
[6. , 2.2]])
>>> dataset = pd.DataFrame({'Column1': data[:, 0], 'Column2': data[:, 1]})
>>> print(dataset)
Column1 Column2
0 5.8 2.8
1 6.0 2.2
Example 3: create table numpy
df = pd.DataFrame(data=numpy_data, index=["row1", "row2"], columns=["column1", "column2"])