我有一个模型,在这个模型中,我每月都会获取published count
,under process count
,rejected count
,received count
class PreData(models.Model):
status=models.CharField(max_length=200,default=None,null=True)
receivedon=models.DateField(default=None,blank=False,null=True)
publishedon = models.DateField(default=None, blank=True, null=True)
在cd7}模型中, 在编写完下面的查询之后,我很难理解如何获取数据来填充列(见图)。我不确定我写的查询是否有用。在 当我想压缩 I need the data to fill these columns 我们非常感谢您的帮助。在received_monthly_data
和published_monthly_data
时,问题就来了,但是received_monthly_data
有四月月份的数据,而{
也许您可以使用
itertools.zip_longest
,它将压缩最长的序列,并用None
替换较短序列中丢失的值。这样你就不会丢失4月份的数据。在如果要使用
None
以外的值,请指定fillvalue
参数。在来自https://docs.python.org/3/library/itertools.html#itertools.zip_longest
注意,在Python2中,这个函数被称为
itertools.izip_longest
。在相关问题 更多 >
编程相关推荐