由于我们没有定义数据帧的列名,因此Pandas默认使用序号作为列名。...即可:
pd.DataFrame(fruits_list)
得到的数据帧结构如下:
?...4、使用字典创建Pandas DataFrame
字典就是一组键/值对:
dict = {key1 : value1, key2 : value2, key3 : value3}
当我们将上述字典对象转换为...: [5, 10, 8, 3, 7],
'Color': ['Red', 'Yellow', 'Red', 'Brown', 'Yellow']}
现在让我们将这个字典转换为...那么可以使用下面的代码将其转换为Pandas DataFrame:
fruits = pd.read_excel('fruits.xlsx')
得到的数据帧看起来是这样:
?