Common Tips

excel functions

() () Number of cells non-empty statistical countblank cell number () count the number of empty cells cells cells counta count statistics

The maximum value max () statistics cell, ignoring text and logical values, MAXA () is non-empty cell maximum

Min () statistics cell min, ignoring text and logical values, mina () is non-empty cell minimum

sum () and, text and statistics null cells are ignored, SUMIF () and SUMIFS () satisfies the conditions of summing

Mean average () statistics cells, equivalent sum () / count (), averagea () Mean statistical non-empty cells, equivalent sum () / counta ()

Median () value

() The mode mode.mult, the mode may be a plurality (ctrl + shift + enter)

frequency () seeking histogram statistics

var.s () Variance (ignoring text and logical values) calculated for a given sample, of a given sample calculated Vara (including text and a logical value) of the standard deviation, calculated as false, and the string 0, true calculated 1

var.p () Variance (ignoring text and logical values) calculated for a given sample, of a given sample calculated VARPA (including text and a logical value) of the standard deviation, calculated as false, and the string 0, true calculated 1

stdev.s () is calculated to a given sample standard deviation (ignoring text and logical values), calculated STDEVA given sample (including text and a logical value) of the standard deviation, calculated as false, and the string 0, true calculated 1

stdev.p () is calculated based on a given sample population standard based on a difference between a given sample population standard deviation (ignoring text and logical values), calculated STDEVPA (including text and a logical value), and the string false calculated by 0, calculated true 1

 

 

 

jupyter notebook --generate-config configuration file location to find jupyter

Modify c.NotebookApp.notebook_dir = 'file path'  

 

When submitting data using the POST method Form form, necessary to add the template {% csrf_token%}

 

In the ajax, by $ ( '# form'). Serialize () Gets the value of the respective input box form, $ ( '# form') represented by the id of the form to find the form

 

If the variable passed to the template markup language, the display only shows the default variable strings without its original language tag rendered in the template, if you want to render into language labels, you need to add | safe

E.g. incoming variable v = "<a href='#'> Previous </a>", if the template by {{v}} rendering, the display would be a string <a href = '# '> Previous </a>, if you want to display a link to a form required by {{v | safe}} rendering

Or import module from django.utils.safestring import mark_safe, then v = mark_safe ( "<a href='#'> Previous </a>"), can be passed to the template v rendered as a tag

 

zip usage

>>> v1=[1,2,3,4]
>>> v2=['a','b','c','d']
>>> list(zip(v1,v2))
[(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd')]

>>> v3=[(1,2,3),('a','b','c'),(11,22,33)]
>>> list(zip(*v3))
[(1, 'a', 11), (2, 'b', 22), (3, 'c', 33)]

 

 

from django.shortcuts import render,HttpResponse

from django.http import JsonResponse

The HttpResponse (string), for returning to the page content of the parameter string

render (request, 'xxx.html', { 'y': 'y'}), for returning html page template

JsonResponse (dictionary), for returning the page content parameter dictionary, and the dictionary will be converted to json format; if the parameter is not a dictionary, add the parameter safe = False

 

 

When you create a model to create a joint index

class Meta:

  unique_together = [( 't', 'c')] #t, and c represents the field name

 

URL:from django.urls import reverse

url(r'^all/(?P<article_type_id>\d+).html$', home.index, name='index'),
在HTML中:{% url "index" article_type_id=1 %}   ==>  all/1.html
在views中:reverse('index',kwargs={"article_type_id":1})   ==>  all/1.html

url(r'^all/(\d+).html$', home.index, name='index'),
在HTML中:{% url "index" 1 %}   ==>  all/1.html
在views中:reverse('index',args=(1,))   ==>  all/1.html

 

Method database comes time taken:

mysql:date_format(time,'%Y-%m')

SQLLite:strftime('%Y-%m',time)

 

Guess you like

Origin www.cnblogs.com/Forever77/p/10827830.html