dataframe from records code example
Example: what is from_records in DataFrame() pandas in python?
#import pandas as pd
import pandas as pd
#import numpy as np
import numpy as np
data = np.array([(3, 'a'), (2, 'b'), (1, 'c'), (0, 'd')],dtype=[('col_1', 'i4'), ('col_2', 'U1')])
print("ndarray is:",data)
df=pd.DataFrame.from_records(data)
print("----------The DataFrame is----------")
print(df)