Questions tagged «columnname»

9
熊猫索引列标题或名称
如何获取python pandas中的索引列名称?这是一个示例数据框: Column 1 Index Title Apples 1 Oranges 2 Puppies 3 Ducks 4 我想做的是获取/设置数据框索引标题。这是我尝试过的: import pandas as pd data = {'Column 1' : [1., 2., 3., 4.], 'Index Title' : ["Apples", "Oranges", "Puppies", "Ducks"]} df = pd.DataFrame(data) df.index = df["Index Title"] del df["Index Title"] print df 有人知道怎么做吗?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.