如何在cakephp中显示最后一个链接(How to show the last link in cakephp)
我在cakephp做一个项目。 在这里我需要一个不同的布局。 请看看我的分页要求
<<First <Prev 1|2|3|4|5|6 Next> Last>>
有6个页面项目,每当我到达页面6时,蛋糕将不会显示最后>>,同样的情况在第一个按钮按钮中,它会自动隐藏。
但是我需要为我的分页保留上面的布局,如果我点击任何链接,它应该显示所有链接。
我怎么处理这个? 可能吗?
I am doing a project in cakephp. Here I need a different layout. Please have a look at my pagination requirements
<<First <Prev 1|2|3|4|5|6 Next> Last>>
There are 6 page items ,whenever I reached the page 6 , cake won't display the Last>> ,same case in First Button Button ,it hides that automatically.
However I need to keep the above layout for my pagination , If I click any link ,it should display the all links.
How Could I handle this? Is it possible?
原文:https://stackoverflow.com/questions/9798945
最满意答案
您可以使用:
df = DataFrame( cat = ["a", "b", "c","a"], prices = [1,2,3,4], vol = [10,20,30,40], ) df2 = by(df, :cat) do sub t = DataFrame(prices=mean(sub[:prices]), vol=sum(sub[:vol])) end df2 3×3 DataFrames.DataFrame │ Row │ cat │ prices │ vol │ ├─────┼─────┼────────┼─────┤ │ 1 │ "a" │ 2.5 │ 50 │ │ 2 │ "b" │ 2.0 │ 20 │ │ 3 │ "c" │ 3.0 │ 30 │
如果您必须按日/月/等计算一些总数,您可能也会对此答案感兴趣。
You can use by:
df = DataFrame( cat = ["a", "b", "c","a"], prices = [1,2,3,4], vol = [10,20,30,40], ) df2 = by(df, :cat) do sub t = DataFrame(prices=mean(sub[:prices]), vol=sum(sub[:vol])) end df2 3×3 DataFrames.DataFrame │ Row │ cat │ prices │ vol │ ├─────┼─────┼────────┼─────┤ │ 1 │ "a" │ 2.5 │ 50 │ │ 2 │ "b" │ 2.0 │ 20 │ │ 3 │ "c" │ 3.0 │ 30 │
If you have to make some totals by day/months/etc you may be interested also in this so answer.
相关问答
更多-
df[:Y] = convert(DataArray{Float64,1}, map(z->X[z],df[:Z])) 那样的,还是你在寻找更多的东西? df[:Y] = convert(DataArray{Float64,1}, map(z->X[z],df[:Z])) Like that, or were you looking for something more?
-
对Julia使用R lag(Using R lag for Julia)[2022-02-11]
编辑 : 第二个想法 - 可能与DataFrame的列长度有关并不是最好的做法,我假设你想要一个新的列。 在这种情况下,这可能是一个基本的方法: df[:LagLong] = [missing; df[1:end-1,:Long]] 或者如果你想要NaN (但可能你想失踪,如下所述): df[:LagLong] = [NaN; df[1:end-1,:Long]] 上一个回复 : 你可以做到这一点: julia> x = [1.0,2.0,3.0] 3-element Array{Float64,1}: ... -
在Pandas数据框中以不同的逻辑每列折叠行[重复](Collapse rows in Pandas dataframe with different logic per column [duplicate])[2022-07-02]
使用groubpy和.agg : df.groupby('City', as_index=False).agg({'ColumnA':'min', 'ColumnB':'mean'}) City ColumnA ColumnB 0 Portland 10 32.5 1 Seattle 20 25.0 use groubpy and .agg: df.groupby('City', as_index=False).agg({'ColumnA' ... -
扩展注释oneliner,如果我们将locf定义为: locf(v) = v[cummax([i*!isna(v[i]) for i=1:length(v)])] 然后, nona_df = DataFrame(Any[locf(df[c]) for c in names(df)],names(df)) 和, julia> nona_df 5×1 DataFrames.DataFrame │ Row │ d │ ├─────┼───┤ │ 1 │ 1 │ │ 2 │ 1 │ │ 3 │ 5 ...
-
具有相同时间戳值的不同ID的聚合数据帧[重复](Aggregrate dataframe having different ID's with same timestamp value [duplicate])[2023-10-09]
您可以按小时聚合,首先提取日期和小时,然后根据此新变量进行聚合。 它可能看起来像这样: library(dplyr) ## Some sample data: data <- data.frame( id = c(1001L, 1001L, 1001L, 1001L, 1002L, 1002L), event_time = c("2017-05-22 16:56:07", "2017-05-22 16:57:07", "2017-05-22 ... -
另一种方法可能是 DataFrame(Any[values(x)...],Symbol[map(symbol,keys(x))...]) 获取类型以访问正确的构造函数有点棘手。 为了获得DataFrame的构造函数列表,我使用了methods(DataFrame) 。 DataFrame(a=[1,2,3])创建DataFrame的方式使用关键字参数。 要使用splatting( ... )作为关键字参数,密钥必须是符号。 在示例中, x具有字符串,但这些字符串可以转换为符号。 在代码中,这是: Data ...
-
如何在Julia`DataFrame`中使用重复的时间戳折叠数据(How to collapse data with duplicate timestamps in Julia `DataFrame`)[2023-03-19]
您可以使用: df = DataFrame( cat = ["a", "b", "c","a"], prices = [1,2,3,4], vol = [10,20,30,40], ) df2 = by(df, :cat) do sub t = DataFrame(prices=mean(sub[:prices]), vol=sum(sub[:vol])) end df2 3×3 DataFrames.DataFrame │ Row │ cat │ prices │ vo ... -
这可以通过一次转换一个tz来有效地完成(但由于我们有很多,groupby已经将它们分开)。 这些是本地时间(在给tz_localize IOW),因此tz_localize使这些tz感知。 然后,当我们将它们组合在一起时,它们会自动神奇地转换为UTC。 请注意,这是在master / 0.17.0上,很快就会发布。 溶解<0.17.0以下 In [19]: df = read_csv(StringIO(data),header=None, names=['value','date','tz']) In [ ...
-
错误消息表明您正在尝试在DataFrame和Array之间进行DataFrame元素减法.- ,但该操作没有针对这些类型的定义。 这种情况的一个愚蠢的例子: julia> "a" .- [1, 2, 3] ERROR: `.-` has no method matching .-(::ASCIIString, ::Array{Int64,1}) 我的猜测是,如果你添加 println(typeof(x_train)) 在前面 x_train = fit_transform!(std_scalar, x_ ...
-
如何在Julia中将IndexedTable转换为DataFrame?(How to convert an IndexedTable to a DataFrame in Julia?)[2021-10-11]
以下转换功能: toDataFrame(cols::Tuple, prefix="x") = DataFrame(;(Symbol("$prefix$c") => cols[c] for c in fieldnames(cols))...) toDataFrame(cols::NamedTuples.NamedTuple, prefix="x") = DataFrame(;(c => cols[c] for c in fieldnames(cols))...) toDataFrame(t:: ...