小编Gui*_*nha的帖子

气流网络服务器开始值错误:Samesite

我在我的一个环境中使用 Anaconda 安装了 Airflow 1.10.12。

但是当我尝试按照快速入门指南(在https://airflow.apache.org/docs/stable/start.html)访问 http://localhost:8080/admin/ 后出现以下错误

Traceback (most recent call last):
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/flask/app.py", line 1953, in full_dispatch_request
    return self.finalize_request(rv)
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/flask/app.py", line 1970, in finalize_request
    response = self.process_response(response)
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/flask/app.py", line 2269, in process_response
    self.session_interface.save_session(self, ctx.session, response)
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/flask/sessions.py", line 379, in save_session
    response.set_cookie(
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/werkzeug/wrappers/base_response.py", line 468, in set_cookie
    dump_cookie(
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/werkzeug/http.py", line 1217, in dump_cookie
    raise ValueError("SameSite must be 'Strict', 'Lax', or 'None'.")
ValueError: SameSite …
Run Code Online (Sandbox Code Playgroud)

python anaconda airflow

7
推荐指数
1
解决办法
1725
查看次数

注册后如何在allauth中自定义用户配置文件字段

我使用allauth来注册Web应用程序中的功能。在社交帐户中,注册是从用户的电子邮件,密码,名字和姓氏中收集的。在登录表单中,我只是收集用户的电子邮件和密码。

登录后,我的应用程序会将用户重定向到个人资料页面,如果他/她想这样做,他/她应该在该页面上更新她的个人资料(包括新的和自定义的字段,作为我添加的“机构”)。

作为django-allauth的初学者,我想知道如何将这些新的自定义字段添加到我的用户个人资料中,以及如何在用户注册后更新这些数据。

我到目前为止所做的:

在settings.py中

AUTH_USER_MODEL = 'auth.User'
Run Code Online (Sandbox Code Playgroud)

在my_project / models.py中

from django.db import models
from django.contrib.auth.models import User

class UserProfile(models.Model):

    institution = models.TextField(max_length=254)
Run Code Online (Sandbox Code Playgroud)

在profile_page.html中

{% extends 'base.html' %}
{% block title %}Profile Page{%endblock title%}

{% if user.is_authenticated %}

{%block body%}

    <div class="col-md-6" >
        <div class="panel panel-default">
            <div class="panel-body">
                <h1 class="text-center"><b>MY ONTOLOGIES</b></h1><br>
            </div>
        </div>
    </div>
    <div class="col-md-6" >
        <div class="panel panel-default">
            <div class="panel-body">
                <h1 class="text-center"><b>MY PROFILE</b></h1><br>
                    <div class="form-group">
                        {% csrf_token %}
                        <label for="id_login" class="col-sm-2 control-label">E-mail:</label>
                        <div class="col-sm-10">
                            <input type="email" id="asd" …
Run Code Online (Sandbox Code Playgroud)

django django-allauth

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

气流 initdb:无法从“pendulum”导入名称“Pendulum”

我在名为 engdados 的 Anaconda 环境之一中安装了气流。当我执行命令 airflow initdb 时,出现以下错误:airflow initdb: cannot import name 'Pendulum' from 'pendulum'。完整的回溯如下所示:

(engdados) guilherme@Athena-LNX:~$ airflow initdb
Traceback (most recent call last):
  File "/home/guilherme/anaconda3/envs/engdados/bin/airflow", line 25, in <module>
    from airflow.configuration import conf
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/airflow/__init__.py", line 47, in <module>
    settings.initialize()
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/airflow/settings.py", line 403, in initialize
    configure_adapters()
  File "/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/airflow/settings.py", line 319, in configure_adapters
    from pendulum import Pendulum
ImportError: cannot import name 'Pendulum' from 'pendulum' (/home/guilherme/anaconda3/envs/engdados/lib/python3.8/site-packages/pendulum/__init__.py)
(engdados) guilherme@Athena-LNX:~$ service start mysql$
start: unrecognized service
(engdados) guilherme@Athena-LNX:~$ service mysql …
Run Code Online (Sandbox Code Playgroud)

airflow pendulum

4
推荐指数
1
解决办法
5163
查看次数

Pandas 错误:索引包含重复条目,无法重塑

我的问题似乎重复,因为我发现不同的问题具有相同的错误,如下所示:

Pandas:根据值对列进行分组并创建新的列标题

Python/Pandas - ValueError:索引包含重复条目,无法重塑

Pandas 数据透视产生“ValueError:索引包含重复条目,无法重塑

我尝试了这些帖子中提出的所有解决方案,但没有一个有效。我相信该错误可能是由我的数据集格式引起的,该格式具有字符串而不是数字,并且可能存在重复的整体。以下是我的数据集的示例:

协议号 活动 描述
1586212 一天两次
1586212 驾驶 5公里
1586212 驾驶 至少30分钟
1586212 睡觉
1586212 1500卡路里
2547852
2547852 驾驶
2547852 3200卡路里
2547852 避免面食
2547852 睡觉 至少10小时

我想要实现的输出是:

协议号 驾驶 睡觉
1586212 一天两次 5公里 1500卡路里
2547852 3200卡路里 至少10小时

我尝试使用pivot和pivot_table,代码如下:

df.pivot(index="protocol_no", columns="activity", values="description")
Run Code Online (Sandbox Code Playgroud)

但我仍然收到此错误:

ValueError: Index contains duplicate entries, cannot reshape
Run Code Online (Sandbox Code Playgroud)

不知道出了什么问题,所以任何帮助都会有帮助!

编辑:

我注意到我的数据包含错误以及 @DYZ 和 @SeaBean 用户所述的重复整体。因此,我编辑了数据库示例,并为我的数据集提供了正确的答案。希望它能帮助某人。

python pandas

3
推荐指数
1
解决办法
9075
查看次数

标签 统计

airflow ×2

python ×2

anaconda ×1

django ×1

django-allauth ×1

pandas ×1

pendulum ×1