Python 熊猫:在创建DataFrame时指定列标签返回NaN

Python 熊猫:在创建DataFrame时指定列标签返回NaN,python,pandas,Python,Pandas,下面的代码返回一个带有NaN值的数据帧 my_columns = ['Current', 'In 6 Months', 'Under Stress'] my_index = ['Liquid Assets', 'Cash & Short Duration Bonds', 'Illiquid Assets'] combined_df = pd.DataFrame([curr_data, in6m_data, understress_data], index = my_index, colu

下面的代码返回一个带有NaN值的数据帧

my_columns = ['Current', 'In 6 Months', 'Under Stress']
my_index = ['Liquid Assets', 'Cash & Short Duration Bonds', 'Illiquid Assets']
combined_df = pd.DataFrame([curr_data, in6m_data, understress_data], index = my_index, columns = my_columns)
虽然这很有效

my_columns = ['Current', 'In 6 Months', 'Under Stress']
my_index = ['Liquid Assets', 'Cash & Short Duration Bonds', 'Illiquid Assets']
combined_df = pd.DataFrame([curr_data, in6m_data, understress_data], index = my_index)
combined_df.columns = my_columns


curr_data
0    4.490472e+09
1    2.911620e+08
2    6.931839e+08
Name: Current, dtype: float64

in6m_data
0    4.031035e+09
1    2.910907e+08
2    5.764309e+08
Name: In 6 Months, dtype: float64

understress_data
0    8.127460e+08
1    3.324597e+08
2    2.656221e+09
Name: Under Stress, dtype: float64

有人知道原因/区别吗?

我试着用虚拟数字运行代码,效果很好。关于curr_数据、in6m_数据和欠应力_数据。您使用的是什么版本的
pandas
?我刚刚测试了你的代码,在我这方面效果很好。不确定。我正在运行Anaconda1.8.0(python 2.7.5)。。。已经严重过时了。巨蟒已经达到了2.1.0。尝试在命令行上执行
导入熊猫
然后
打印熊猫。作为参考,我正在使用运行Python2.7.8的最新Anaconda发行版以及最新的
pandas
。谢谢您的提示。版本0.12.0