小编Nan*_*ana的帖子

如何使用Django Paginator在页面上拆分DataFrame(pandas)?

这很容易Series。我只是将其传递给paginator。但是,当我使用时DataFrame,它被称为“系列的真值不明确”。也许count方法有问题,但我不知道该如何更改。在我的项目中,DataFrame必须按行在页面上拆分。

def listing(request):
    contact_list = pd.DataFrame(np.arange(12).reshape(4,3))
    paginator = Paginator(contact_list, 1)  # Show 1 row per page

page = request.GET.get('page')
try:
    contacts = paginator.page(page)
except PageNotAnInteger:
    # If page is not an integer, deliver first page.
    contacts = paginator.page(1)
except EmptyPage:
    # If page is out of range (e.g. 9999), deliver last page of results.
    contacts = paginator.page(paginator.num_pages)

return render(request, 'list.html', {'contacts': contacts})
Run Code Online (Sandbox Code Playgroud)

python django django-pagination pandas

6
推荐指数
1
解决办法
1390
查看次数

理解“git remote show”命令输出...“为‘git push’配置的本地引用”的含义是什么?

我有两个遥控器和两个本地分支机构:

  • 本地分支“master”正在跟踪远程分支“origin/master”
  • 本地分支“mirror”正在跟踪远程分支“github/master”

这是在我的 .git/config 文件中:

...

[remote "origin"]
    url = http://my.gitlab.com/nandoquintana/repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[remote "github"]
    url = https://github.com/nandoquintana/repo.git
    fetch = +refs/heads/*:refs/remotes/github/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[branch "mirror"]
    remote = github
    merge = refs/heads/master
[push]
    default = tracking
Run Code Online (Sandbox Code Playgroud)

这是“git Remote show origin”的输出:

$ git remote show origin 

* remote origin
  Fetch URL: http://my.gitlab.com/nandoquintana/repo.git
  Push  URL: http://my.gitlab.com/nandoquintana/repo.git
  HEAD branch: master
  Remote branch:
    master tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local …
Run Code Online (Sandbox Code Playgroud)

git github git-branch

5
推荐指数
1
解决办法
3015
查看次数

terraform plan 通知基础设施的变化,但也说没有变化

当我跑

它显示了 Terraform 所做更改的列表,并在输出结束时通知“没有更改。您的基础设施与配置匹配。”:

Note: Objects have changed outside of Terraform

Terraform detected the following changes made outside of Terraform since the last "terraform apply":

  # google_sql_database_instance.db1 has been changed
  ~ resource "google_sql_database_instance" "db1" {
        id                            = "db1"
        name                          = "db1"
        # (12 unchanged attributes hidden)

....
whole list of objects to update
....
....

Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following plan may include actions to …
Run Code Online (Sandbox Code Playgroud)

terraform terraform-provider-gcp

2
推荐指数
1
解决办法
1595
查看次数