小编Sta*_*ark的帖子

Pandas:从 csv 文件中获取数据,而不考虑标题位置

我有我必须做的CSV文件dataframespanda。通常文件的格式如下:

Days    Page Impressions    Visits  Bounces
2012-12-15  692041  87973   31500
2012-12-16  602356  78663   29298
2012-12-17  730902  99356   37436
2012-12-18  730071  97844   37199
2012-12-19  774964  110446  43858
2012-12-20  419256  44592   13961
2012-12-21  320966  33692   10076
2012-12-22  200992  18840   5170
Run Code Online (Sandbox Code Playgroud)


我面临的问题是有时 CSV 文件是这样的:

SomeName ABCD           
Account: AccountHolder Name         
Report Author: Analysis         
Description: Some variable length description       

Pivot           

Pivot           
Days    Page Impressions    Visits  Bounces
2012-12-15  367143  69147   30222
2012-12-16  334675  63702   28040
2012-12-17  409260  77171   33642
2012-12-18  427765  78221 …
Run Code Online (Sandbox Code Playgroud)

python csv dataframe pandas

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

authenticate()得到了一个意外的关键字参数'username'

在尝试验证我的用户时,我在django中遇到了一个奇怪的错误.

这是代码:

views.py

from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.template import RequestContext
from django.core.context_processors import csrf
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth import authenticate, login

def authenticate(request):
    username = request.POST['username']
    password = request.POST['password']
    user = authenticate(username=username, password=password)
    if user is not None:
        if user.is_active:
            login(request, user)
            # Redirect to a success page.
        else:
            pass
            # Return a 'disabled account' error message
    else:
        pass
        # Return an 'invalid login' error message.
Run Code Online (Sandbox Code Playgroud)

它一直给我这个错误:

Environment:


Request Method: POST
Request URL: …
Run Code Online (Sandbox Code Playgroud)

python authentication django django-authentication

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