我正在使用PANDAS groupBy并注意到它正在删除我正在运行它的值的标题名称.
data = pd.read_csv("<CSV FILE NAME>", low_memory=False)
print data.head()
print data.columns
Run Code Online (Sandbox Code Playgroud)
给我以下输出:
Store ID Daily Sales
0 4444444 436
1 4555555 406
2 6435353 487
3 3421456 637
4 1111111 516
Index([u'Store ID', u' Daily Sales'], dtype='object')
Run Code Online (Sandbox Code Playgroud)
我跑的时候
data = data.groupby(['Store Number']).mean()
print data.head()
print data.columns
Run Code Online (Sandbox Code Playgroud)
输出更改为
Daily Sales
Store ID
4166646 236.280394
4166663 152.061884
4166664 131.163746
4166665 144.920044
4166666 225.075027
Index([u'Daily Sales'], dtype='object')
Run Code Online (Sandbox Code Playgroud)
Store ID标头名称将作为值添加,并从标头名称中删除.这背后的原因是什么,是否有修复?
我试图在我的Shiny应用程序的主面板中显示多个图表.
我正在使用R cookbook的多重绘图功能
multiplot <- function(..., plotlist=NULL, file, cols=1, layout=NULL) {
library(grid)
# Make a list from the ... arguments and plotlist
plots <- c(list(...), plotlist)
numPlots = length(plots)
# If layout is NULL, then use 'cols' to determine layout
if (is.null(layout)) {
# Make the panel
# ncol: Number of columns of plots
# nrow: Number of rows needed, calculated from # of cols
layout <- matrix(seq(1, cols * ceiling(numPlots/cols)),
ncol = cols, nrow = ceiling(numPlots/cols))
} …Run Code Online (Sandbox Code Playgroud) 我试图使用linq excel从excel文件中提取整行值.我有所有列名称(有104个不同的名称),现在我只需要获得与每个标题相关联的一行值.我想要做的只是拉出整个第二行的值,但我还没有能够解决这个问题.
有谁知道只拉一排的方法?或者我是否需要以不同的方式处理此问题,并通过标题名称提取单个值.
谢谢.