pandas 系列的名称参数是什么? [英] What is the name parameter in Pandas Series?
问题描述
在系列的文档中,不解释name
和fastpath
的参数.他们是做什么的?
In the doc of Series, the use parameter of name
and fastpath
is not explained. What do they do?
推荐答案
name
参数允许您为Series
对象(即列)命名.这样,当您将其放入DataFrame
时,该列将根据name
参数来命名.
The name
argument allows you to give a name to a Series
object, i.e. to the column. So that when you'll put that in a DataFrame
, the column will be named according to the name
parameter.
示例:
In [1]: s = pd.Series(["A","B","C"], name="foo")
In [2]: s
Out[2]:
0 A
1 B
2 C
Name: foo, dtype: object
In [3]: pd.DataFrame(s)
Out[4]:
foo
0 A
1 B
2 C
如果不给Series
提供name
,它将自动命名.这是dataframe
对象中的0
:
If you don't give a name
to your Series
it will be named automatically. Here it will be a 0
in the dataframe
object:
0
0 A
1 B
2 C
对于fastpath
,它是一个内部参数,并且已经报告了一个问题:
For the fastpath
, it's an internal parameter and an issue has already been reported :
https://github.com/pydata/pandas/issues/6903
这篇关于 pandas 系列的名称参数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!