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
是我想附加的词典。
如何提前或在附加字典时添加这些索引名?请发布带有预期输出的示例输入,以便更好地理解。