type(x)
<class 'pandas.core.frame.DataFrame'>
x.shape
(18, 12)
Для ссылки на первую строку и столбцы 3: 5 с выражением:
type(x.iloc[0,3:5])
<class 'pandas.core.series.Series'>
x.iloc[0,3:5]
total_operating_revenue NaN
net_profit 3.43019e+07
Name: 2001-12-31, dtype: object
Для ссылки на первую строку и столбцы 8:10 с выражением:
type(x.iloc[0,8:10])
<class 'pandas.core.series.Series'>
x.iloc[0,8:10]
total_operating_revenue_parent 5.05e+8
net_profit_parent 4.4e+07
Name: 2001-12-31, dtype: object
Я хочу получить объединенную новую серию (предположим, y
) следующим образом:
type(y)
<class 'pandas.core.series.Series'>
y.shape
(4,)
y
содержит:
total_operating_revenue NaN
net_profit 3.43019e+07
total_operating_revenue_parent 5.05e+8
net_profit_parent 4.4e+07
Name: 2001-12-31, dtype: object
Мои неудачные попытки:
x.iloc[0,[3:5,8:10]]
x.iloc[0,3:5].combine(x.iloc[0,8:10])
pd.concat([x.iloc[0,3:5],x.iloc[0,8:10]],axis=1)
не мое ожидание, полностью отличается от y
.
z = pd.concat([x.iloc[0,3:5],x.iloc[0,8:10]],axis=1)
type(z)
<class 'pandas.core.frame.DataFrame'>
z.shape
(4, 2)