📜  python中DataFrame() pandas中的from_records是什么? - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:43.701000             🧑  作者: Mango

代码示例1
#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)