Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将索引名称添加到数据帧_Python_Pandas_Dataframe_Dictionary - Fatal编程技术网

Python 将索引名称添加到数据帧

Python 将索引名称添加到数据帧,python,pandas,dataframe,dictionary,Python,Pandas,Dataframe,Dictionary,在我的代码中,我在一段时间内填充了一个数据帧。 一开始它是空的。但我已经知道它应该有哪些索引名 nodes_df = pd.DataFrame() ... nodes_df = nodes_df.append([n_clength], ignore_index=True) ... nodes_df.append([n_min_dist, n_closest_node_coord], ignore_index=True) 索引名应该是[“clength”、“dist”、“cst_coord”]。

在我的代码中,我在一段时间内填充了一个数据帧。 一开始它是空的。但我已经知道它应该有哪些索引名

nodes_df = pd.DataFrame()
...
nodes_df = nodes_df.append([n_clength], ignore_index=True)
...
nodes_df.append([n_min_dist, n_closest_node_coord], ignore_index=True)
索引名应该是
[“clength”、“dist”、“cst_coord”]
n_clength、n_min_dist和n_closest_node_coord
是我想附加的词典。
如何提前或在附加字典时添加这些索引名?

请发布带有预期输出的示例输入,以便更好地理解。