显示数据框的标题

我想查看数据帧的前20行,其中x> 2,另外,应基于x列从最高到最低编号对行进行排序。参见示例

df

  x y z
a 3 1 0
b 5 2 2
c 1 0 2

结果

  x y z
b 5 1 0
a 3 2 2
foevermore 回答:显示数据框的标题

使用dplyr

df %>%
filter(x>2) %>%
arrange(desc(x)) %>%
head(20)
,

我希望使用库type Trade = { Timestamp : DateTime Symbol : string Side : string Size : int64 Price : int64 GrossValue : int64 option HomeNotional : float option ForeignNotional : float option } type TradeContainer = { Data : Trade[] } let t = JsonConvert.DeserializeObject<TradeContainer>(x) 和数据集dplyr的以下逻辑可以为您提供帮助:

iris
,

使用基数R,您可以subsetorder

temp <- head(subset(df,x > 2),20)
temp[order(-temp$x),]

#  x y z
#b 5 2 2
#a 3 1 0
本文链接:https://www.f2er.com/3144861.html

大家都在问