我正在使用民意调查应用程序完成DjangoProject教程.正如教程在第4部分中所述,我试图导入'reverse': from django.urls import reverse
但是得到错误:
来自django.urls导入反向ImportError:没有名为urls的模块
我把它改成了ROOT_URLCONF
' urls
',然而,它也没有用.
感谢任何帮助,谢谢.
settings.py
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '3jyaq2i8aii-0m=fqm#7h&ri2+!7x3-x2t(yv1jutwa9kc)t!e'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'polls.apps.PollsConfig',
'django.contrib.admin',
'django.contrib.auth', …
Run Code Online (Sandbox Code Playgroud) 我正在处理一个大型数据集(在python中有pandas),我有一个类似于以下结构的数据帧:
class value
0 1 6
1 1 4
2 1 5
3 5 6
4 5 2
...
n 225 3
Run Code Online (Sandbox Code Playgroud)
然而,这些类不断地在数据帧中增长; 缺少一些值,如示例中所示.我想知道如何从每个类获得简单的统计数据,如min或max,并将其分配给新功能.
class value min
0 1 6 4
1 1 4 4
2 1 5 4
3 5 6 2
4 5 2 2
...
n 225 3 3
Run Code Online (Sandbox Code Playgroud)
我能想出的唯一解决方案是耗时的循环.
我读过我应该能够使用以下代码创建一个ArrayList:
List<String> myList = new ArrayList<>();
Run Code Online (Sandbox Code Playgroud)
然而; 当我这样做时,我得到错误:"类型列表不是通用的;它不能用参数参数化"
import java.awt.List;
import java.util.ArrayList;
public class Euler1 {
public static void main(String[] args) {
List<String> nuList = new ArrayList<>();
}
}
Run Code Online (Sandbox Code Playgroud)