我有一个返回不同列表的函数(可变数量的列表,可能是1,可能是10,可能是200 - 在这种情况下,由于字符限制,我们只有一个):
def dic2manylists(*dicts):
"""
Receives a dictionaries with tuples as values and turns it into different lists correctly sorted
:param dic: dictionary with many different values grouped in touples
:return: different lists correctly sorted
"""
for i in dicts:
sorted_dict=sorted(i.items())
for item in range(len(sorted_dict[1][1])):
list=[]
for y in range(len(sorted_dict)):
list.append(sorted_dict[y][1][item])
return list
此函数返回以下内容:
['21', '28', '28', '18', '17', '17', '18', '16', '20', '21', '22', '22', '20', '17', '23', '21', '20', '21', '21', '22', '22', '22', '21', '22', '21', '20', '21', '20', '22', '21', '24', '24', '23', '23', '23', '22', '22', '22', '23', '24', '22', '23', '24', '20', '22', '23', '24', '23', '24', '22', '25', '26', '22', '21', '21', '21', '21', '20', '21', '23', '23', '23', '24', '21', '26', '26', '27', '26', '26', '29', '27', '26', '25', '27', '27', '26', '26', '24', '24', '23', '26', '24', '26', '29', '29', '28', '27', '27', '26', '26', '26', '28', '25', '26', '26', '24', '25', '25', '26', '25', '25', '25', '26', '31', '25', '24', '24', '24', '24', '24', '25', '24', '22', '26', '27', '26', '27', '28', '25', '28', '27', '28', '27', '29', '28', '28', '29', '28', '28', '25', '27', '27', '27', '27', '27', '29', '31', '30', '28', '28', '27', '28', '28', '27', '26', '28', '27', '25', '27', '25', '27', '26', '26', '27', '28', '32', '28', '26', '27', '26', '25', '25', '26', '25', '26', '25', '27', '26', '26', '25', '28', '28', '29', '29', '31', '34', '33', '31', '32', '32', '30', '32', '32', '31', '32', '33', '35', '36', '37', '35', '35', '34', '33', '32', '32', '34', '32', '32', '32', '31', '32', '31', '33', '31', '33', '33', '34', '37', '32', '32', '32', '32', '32', '30', '34', '35', '33', '35', '34', '32', '36', '38', '38', '38', '37', '37', '38', '39', '37', '38', '38', '39', '39', '39', '38', '39', '38', '41', '39', '43', '44', '44', '45', '44', '42', '42', '44', '43', '41', '43', '43', '43', '40', '41', '39', '41', '39', '40', '40', '45', '42', '41', '40', '40', '41', '40', '42', '42', '38', '42', '44', '45', '45', '45', '44', '46', '48', '47', '50', '51', '50', '51', '49', '50', '48', '49', '50', '51', '50', '52', '53', '56', '57', '55', '54', '53', '55', '53', '54', '51', '53', '52', '51', '49', '48', '48', '49', '50', '47', '48', '51', '53', '53', '50', '47', '47', '48', '47', '48', '47', '49', '48', '52', '60', '58', '55', '100', '61', '55', '55', '54', '54', '54', '55', '55', '54', '53', '54', '53', '55', '56', '54', '55', '56', '58', '56', '56', '56', '55', '54', '55', '56', '56', '56', '56', '53', '54', '54', '54', '54', '52', '52', '54', '57', '58', '55', '54', '52', '52', '52', '54', '55', '54', '53', '53', '56', '57', '56', '56', '58', '55', '61', '59', '60', '61', '60', '64', '61', '62', '61', '60', '62', '63', '63', '65', '67', '69', '71', '68', '69', '66', '68', '70', '69', '69', '70', '69', '67', '68', '66', '65', '66', '63', '63', '64', '66', '72', '68', '65', '62', '64', '61', '63', '60', '59', '62', '63', '64', '65', '63', '61', '64', '63', '61', '61', '63', '64', '64', '63', '62', '65', '64', '64', '64', '64', '68', '66', '68', '69', '72', '70', '68', '66', '68', '65', '71', '69', '62', '63', '64', '61', '63', '64', '64', '64', '62', '60', '62', '70', '66', '65', '62', '62', '62', '62', '60', '64', '64', '64', '66', '66', '63', '69', '68', '66', '67', '69', '68', '67', '67', '68', '66', '68', '67', '68', '70', '71', '69', '70', '70', '75', '75', '73', '69', '71', '69', '69', '69', '73', '71', '71', '69', '67', '67', '65', '68', '69', '64', '66', '65', '70', '66', '66', '64', '63', '65', '64', '65', '66', '65', '65', '66', '68', '65', '65', '69', '66', '68', '65', '70', '69', '71', '69', '71', '72', '69', '68', '67', '68', '71', '72', '74', '76', '72', '71', '72', '70', '69', '67', '70', '70', '66', '66', '68', '67', '66', '67', '65', '74', '68', '67', '69', '69', '68', '69', '67', '67', '66', '64', '63', '66', '66', '66', '66', '66', '64', '62', '66', '66', '65', '66', '68', '70', '69', '68', '67', '67', '67', '64', '67', '66', '68', '66', '69', '68', '69', '69', '65', '66', '69', '68', '69', '66', '65', '65', '66', '66', '65', '66']
我有另一个函数返回日期列表,如下所示:
datelist=[datetime.datetime(2004, 1, 11, 0, 0), datetime.datetime(2004, 1, 18, 0, 0), datetime.datetime(2004, 1, 25, 0, 0), datetime.datetime(2004, 2, 1, 0, 0), datetime.datetime(2004, 2, 8, 0, 0), datetime.datetime(2004, 2, 15, 0, 0), datetime.datetime(2004, 2, 22, 0, 0), datetime.datetime(2004, 2, 29, 0, 0), datetime.datetime(2004, 3, 7, 0, 0), datetime.datetime(2004, 3, 14, 0, 0), datetime.datetime(2004, 3, 21, 0, 0), datetime.datetime(2004, 3, 28, 0, 0), datetime.datetime(2004, 4, 4, 0, 0), datetime.datetime(2004, 4, 11, 0, 0), datetime.datetime(2004, 4, 18, 0, 0), datetime.datetime(2004, 4, 25, 0, 0), datetime.datetime(2004, 5, 2, 0, 0), datetime.datetime(2004, 5, 9, 0, 0), datetime.datetime(2004, 5, 16, 0, 0), datetime.datetime(2004, 5, 23, 0, 0), datetime.datetime(2004, 5, 30, 0, 0), datetime.datetime(2004, 6, 6, 0, 0), datetime.datetime(2004, 6, 13, 0, 0), datetime.datetime(2004, 6, 20, 0, 0), datetime.datetime(2004, 6, 27, 0, 0), datetime.datetime(2004, 7, 4, 0, 0), datetime.datetime(2004, 7, 11, 0, 0), datetime.datetime(2004, 7, 18, 0, 0), datetime.datetime(2004, 7, 25, 0, 0), datetime.datetime(2004, 8, 1, 0, 0), datetime.datetime(2004, 8, 8, 0, 0), datetime.datetime(2004, 8, 15, 0, 0), datetime.datetime(2004, 8, 22, 0, 0), datetime.datetime(2004, 8, 29, 0, 0), datetime.datetime(2004, 9, 5, 0, 0), datetime.datetime(2004, 9, 12, 0, 0), datetime.datetime(2004, 9, 19, 0, 0), datetime.datetime(2004, 9, 26, 0, 0), datetime.datetime(2004, 10, 3, 0, 0), datetime.datetime(2004, 10, 10, 0, 0), datetime.datetime(2004, 10, 17, 0, 0), datetime.datetime(2004, 10, 24, 0, 0), datetime.datetime(2004, 10, 31, 0, 0), datetime.datetime(2004, 11, 7, 0, 0), datetime.datetime(2004, 11, 14, 0, 0), datetime.datetime(2004, 11, 21, 0, 0), datetime.datetime(2004, 11, 28, 0, 0), datetime.datetime(2004, 12, 5, 0, 0), datetime.datetime(2004, 12, 12, 0, 0), datetime.datetime(2004, 12, 19, 0, 0), datetime.datetime(2004, 12, 26, 0, 0), datetime.datetime(2005, 1, 2, 0, 0), datetime.datetime(2005, 1, 9, 0, 0), datetime.datetime(2005, 1, 16, 0, 0), datetime.datetime(2005, 1, 23, 0, 0), datetime.datetime(2005, 1, 30, 0, 0), datetime.datetime(2005, 2, 6, 0, 0), datetime.datetime(2005, 2, 13, 0, 0), datetime.datetime(2005, 2, 20, 0, 0), datetime.datetime(2005, 2, 27, 0, 0), datetime.datetime(2005, 3, 6, 0, 0), datetime.datetime(2005, 3, 13, 0, 0), datetime.datetime(2005, 3, 20, 0, 0), datetime.datetime(2005, 3, 27, 0, 0), datetime.datetime(2005, 4, 3, 0, 0), datetime.datetime(2005, 4, 10, 0, 0), datetime.datetime(2005, 4, 17, 0, 0), datetime.datetime(2005, 4, 24, 0, 0), datetime.datetime(2005, 5, 1, 0, 0), datetime.datetime(2005, 5, 8, 0, 0), datetime.datetime(2005, 5, 15, 0, 0), datetime.datetime(2005, 5, 22, 0, 0), datetime.datetime(2005, 5, 29, 0, 0), datetime.datetime(2005, 6, 5, 0, 0), datetime.datetime(2005, 6, 12, 0, 0), datetime.datetime(2005, 6, 19, 0, 0), datetime.datetime(2005, 6, 26, 0, 0), datetime.datetime(2005, 7, 3, 0, 0), datetime.datetime(2005, 7, 10, 0, 0), datetime.datetime(2005, 7, 17, 0, 0), datetime.datetime(2005, 7, 24, 0, 0), datetime.datetime(2005, 7, 31, 0, 0), datetime.datetime(2005, 8, 7, 0, 0), datetime.datetime(2005, 8, 14, 0, 0), datetime.datetime(2005, 8, 21, 0, 0), datetime.datetime(2005, 8, 28, 0, 0), datetime.datetime(2005, 9, 4, 0, 0), datetime.datetime(2005, 9, 11, 0, 0), datetime.datetime(2005, 9, 18, 0, 0), datetime.datetime(2005, 9, 25, 0, 0), datetime.datetime(2005, 10, 2, 0, 0), datetime.datetime(2005, 10, 9, 0, 0), datetime.datetime(2005, 10, 16, 0, 0), datetime.datetime(2005, 10, 23, 0, 0), datetime.datetime(2005, 10, 30, 0, 0), datetime.datetime(2005, 11, 6, 0, 0), datetime.datetime(2005, 11, 13, 0, 0), datetime.datetime(2005, 11, 20, 0, 0), datetime.datetime(2005, 11, 27, 0, 0), datetime.datetime(2005, 12, 4, 0, 0), datetime.datetime(2005, 12, 11, 0, 0), datetime.datetime(2005, 12, 18, 0, 0), datetime.datetime(2005, 12, 25, 0, 0), datetime.datetime(2006, 1, 1, 0, 0), datetime.datetime(2006, 1, 8, 0, 0), datetime.datetime(2006, 1, 15, 0, 0), datetime.datetime(2006, 1, 22, 0, 0), datetime.datetime(2006, 1, 29, 0, 0), datetime.datetime(2006, 2, 5, 0, 0), datetime.datetime(2006, 2, 12, 0, 0), datetime.datetime(2006, 2, 19, 0, 0), datetime.datetime(2006, 2, 26, 0, 0), datetime.datetime(2006, 3, 5, 0, 0), datetime.datetime(2006, 3, 12, 0, 0), datetime.datetime(2006, 3, 19, 0, 0), datetime.datetime(2006, 3, 26, 0, 0), datetime.datetime(2006, 4, 2, 0, 0), datetime.datetime(2006, 4, 9, 0, 0), datetime.datetime(2006, 4, 16, 0, 0), datetime.datetime(2006, 4, 23, 0, 0), datetime.datetime(2006, 4, 30, 0, 0), datetime.datetime(2006, 5, 7, 0, 0), datetime.datetime(2006, 5, 14, 0, 0), datetime.datetime(2006, 5, 21, 0, 0), datetime.datetime(2006, 5, 28, 0, 0), datetime.datetime(2006, 6, 4, 0, 0), datetime.datetime(2006, 6, 11, 0, 0), datetime.datetime(2006, 6, 18, 0, 0), datetime.datetime(2006, 6, 25, 0, 0), datetime.datetime(2006, 7, 2, 0, 0), datetime.datetime(2006, 7, 9, 0, 0), datetime.datetime(2006, 7, 16, 0, 0), datetime.datetime(2006, 7, 23, 0, 0), datetime.datetime(2006, 7, 30, 0, 0), datetime.datetime(2006, 8, 6, 0, 0), datetime.datetime(2006, 8, 13, 0, 0), datetime.datetime(2006, 8, 20, 0, 0), datetime.datetime(2006, 8, 27, 0, 0), datetime.datetime(2006, 9, 3, 0, 0), datetime.datetime(2006, 9, 10, 0, 0), datetime.datetime(2006, 9, 17, 0, 0), datetime.datetime(2006, 9, 24, 0, 0), datetime.datetime(2006, 10, 1, 0, 0), datetime.datetime(2006, 10, 8, 0, 0), datetime.datetime(2006, 10, 15, 0, 0), datetime.datetime(2006, 10, 22, 0, 0), datetime.datetime(2006, 10, 29, 0, 0), datetime.datetime(2006, 11, 5, 0, 0), datetime.datetime(2006, 11, 12, 0, 0), datetime.datetime(2006, 11, 19, 0, 0), datetime.datetime(2006, 11, 26, 0, 0), datetime.datetime(2006, 12, 3, 0, 0), datetime.datetime(2006, 12, 10, 0, 0), datetime.datetime(2006, 12, 17, 0, 0), datetime.datetime(2006, 12, 24, 0, 0), datetime.datetime(2006, 12, 31, 0, 0), datetime.datetime(2007, 1, 7, 0, 0), datetime.datetime(2007, 1, 14, 0, 0), datetime.datetime(2007, 1, 21, 0, 0), datetime.datetime(2007, 1, 28, 0, 0), datetime.datetime(2007, 2, 4, 0, 0), datetime.datetime(2007, 2, 11, 0, 0), datetime.datetime(2007, 2, 18, 0, 0), datetime.datetime(2007, 2, 25, 0, 0), datetime.datetime(2007, 3, 4, 0, 0), datetime.datetime(2007, 3, 11, 0, 0), datetime.datetime(2007, 3, 18, 0, 0), datetime.datetime(2007, 3, 25, 0, 0), datetime.datetime(2007, 4, 1, 0, 0), datetime.datetime(2007, 4, 8, 0, 0), datetime.datetime(2007, 4, 15, 0, 0), datetime.datetime(2007, 4, 22, 0, 0), datetime.datetime(2007, 4, 29, 0, 0), datetime.datetime(2007, 5, 6, 0, 0), datetime.datetime(2007, 5, 13, 0, 0), datetime.datetime(2007, 5, 20, 0, 0), datetime.datetime(2007, 5, 27, 0, 0), datetime.datetime(2007, 6, 3, 0, 0), datetime.datetime(2007, 6, 10, 0, 0), datetime.datetime(2007, 6, 17, 0, 0), datetime.datetime(2007, 6, 24, 0, 0), datetime.datetime(2007, 7, 1, 0, 0), datetime.datetime(2007, 7, 8, 0, 0), datetime.datetime(2007, 7, 15, 0, 0), datetime.datetime(2007, 7, 22, 0, 0), datetime.datetime(2007, 7, 29, 0, 0), datetime.datetime(2007, 8, 5, 0, 0), datetime.datetime(2007, 8, 12, 0, 0), datetime.datetime(2007, 8, 19, 0, 0), datetime.datetime(2007, 8, 26, 0, 0), datetime.datetime(2007, 9, 2, 0, 0), datetime.datetime(2007, 9, 9, 0, 0), datetime.datetime(2007, 9, 16, 0, 0), datetime.datetime(2007, 9, 23, 0, 0), datetime.datetime(2007, 9, 30, 0, 0), datetime.datetime(2007, 10, 7, 0, 0), datetime.datetime(2007, 10, 14, 0, 0), datetime.datetime(2007, 10, 21, 0, 0), datetime.datetime(2007, 10, 28, 0, 0), datetime.datetime(2007, 11, 4, 0, 0), datetime.datetime(2007, 11, 11, 0, 0), datetime.datetime(2007, 11, 18, 0, 0), datetime.datetime(2007, 11, 25, 0, 0), datetime.datetime(2007, 12, 2, 0, 0), datetime.datetime(2007, 12, 9, 0, 0), datetime.datetime(2007, 12, 16, 0, 0), datetime.datetime(2007, 12, 23, 0, 0), datetime.datetime(2007, 12, 30, 0, 0), datetime.datetime(2008, 1, 6, 0, 0), datetime.datetime(2008, 1, 13, 0, 0), datetime.datetime(2008, 1, 20, 0, 0), datetime.datetime(2008, 1, 27, 0, 0), datetime.datetime(2008, 2, 3, 0, 0), datetime.datetime(2008, 2, 10, 0, 0), datetime.datetime(2008, 2, 17, 0, 0), datetime.datetime(2008, 2, 24, 0, 0), datetime.datetime(2008, 3, 2, 0, 0), datetime.datetime(2008, 3, 9, 0, 0), datetime.datetime(2008, 3, 16, 0, 0), datetime.datetime(2008, 3, 23, 0, 0), datetime.datetime(2008, 3, 30, 0, 0), datetime.datetime(2008, 4, 6, 0, 0), datetime.datetime(2008, 4, 13, 0, 0), datetime.datetime(2008, 4, 20, 0, 0), datetime.datetime(2008, 4, 27, 0, 0), datetime.datetime(2008, 5, 4, 0, 0), datetime.datetime(2008, 5, 11, 0, 0), datetime.datetime(2008, 5, 18, 0, 0), datetime.datetime(2008, 5, 25, 0, 0), datetime.datetime(2008, 6, 1, 0, 0), datetime.datetime(2008, 6, 8, 0, 0), datetime.datetime(2008, 6, 15, 0, 0), datetime.datetime(2008, 6, 22, 0, 0), datetime.datetime(2008, 6, 29, 0, 0), datetime.datetime(2008, 7, 6, 0, 0), datetime.datetime(2008, 7, 13, 0, 0), datetime.datetime(2008, 7, 20, 0, 0), datetime.datetime(2008, 7, 27, 0, 0), datetime.datetime(2008, 8, 3, 0, 0), datetime.datetime(2008, 8, 10, 0, 0), datetime.datetime(2008, 8, 17, 0, 0), datetime.datetime(2008, 8, 24, 0, 0), datetime.datetime(2008, 8, 31, 0, 0), datetime.datetime(2008, 9, 7, 0, 0), datetime.datetime(2008, 9, 14, 0, 0), datetime.datetime(2008, 9, 21, 0, 0), datetime.datetime(2008, 9, 28, 0, 0), datetime.datetime(2008, 10, 5, 0, 0), datetime.datetime(2008, 10, 12, 0, 0), datetime.datetime(2008, 10, 19, 0, 0), datetime.datetime(2008, 10, 26, 0, 0), datetime.datetime(2008, 11, 2, 0, 0), datetime.datetime(2008, 11, 9, 0, 0), datetime.datetime(2008, 11, 16, 0, 0), datetime.datetime(2008, 11, 23, 0, 0), datetime.datetime(2008, 11, 30, 0, 0), datetime.datetime(2008, 12, 7, 0, 0), datetime.datetime(2008, 12, 14, 0, 0), datetime.datetime(2008, 12, 21, 0, 0), datetime.datetime(2008, 12, 28, 0, 0), datetime.datetime(2009, 1, 4, 0, 0), datetime.datetime(2009, 1, 11, 0, 0), datetime.datetime(2009, 1, 18, 0, 0), datetime.datetime(2009, 1, 25, 0, 0), datetime.datetime(2009, 2, 1, 0, 0), datetime.datetime(2009, 2, 8, 0, 0), datetime.datetime(2009, 2, 15, 0, 0), datetime.datetime(2009, 2, 22, 0, 0), datetime.datetime(2009, 3, 1, 0, 0), datetime.datetime(2009, 3, 8, 0, 0), datetime.datetime(2009, 3, 15, 0, 0), datetime.datetime(2009, 3, 22, 0, 0), datetime.datetime(2009, 3, 29, 0, 0), datetime.datetime(2009, 4, 5, 0, 0), datetime.datetime(2009, 4, 12, 0, 0), datetime.datetime(2009, 4, 19, 0, 0), datetime.datetime(2009, 4, 26, 0, 0), datetime.datetime(2009, 5, 3, 0, 0), datetime.datetime(2009, 5, 10, 0, 0), datetime.datetime(2009, 5, 17, 0, 0), datetime.datetime(2009, 5, 24, 0, 0), datetime.datetime(2009, 5, 31, 0, 0), datetime.datetime(2009, 6, 7, 0, 0), datetime.datetime(2009, 6, 14, 0, 0), datetime.datetime(2009, 6, 21, 0, 0), datetime.datetime(2009, 6, 28, 0, 0), datetime.datetime(2009, 7, 5, 0, 0), datetime.datetime(2009, 7, 12, 0, 0), datetime.datetime(2009, 7, 19, 0, 0), datetime.datetime(2009, 7, 26, 0, 0), datetime.datetime(2009, 8, 2, 0, 0), datetime.datetime(2009, 8, 9, 0, 0), datetime.datetime(2009, 8, 16, 0, 0), datetime.datetime(2009, 8, 23, 0, 0), datetime.datetime(2009, 8, 30, 0, 0), datetime.datetime(2009, 9, 6, 0, 0), datetime.datetime(2009, 9, 13, 0, 0), datetime.datetime(2009, 9, 20, 0, 0), datetime.datetime(2009, 9, 27, 0, 0), datetime.datetime(2009, 10, 4, 0, 0), datetime.datetime(2009, 10, 11, 0, 0), datetime.datetime(2009, 10, 18, 0, 0), datetime.datetime(2009, 10, 25, 0, 0), datetime.datetime(2009, 11, 1, 0, 0), datetime.datetime(2009, 11, 8, 0, 0), datetime.datetime(2009, 11, 15, 0, 0), datetime.datetime(2009, 11, 22, 0, 0), datetime.datetime(2009, 11, 29, 0, 0), datetime.datetime(2009, 12, 6, 0, 0), datetime.datetime(2009, 12, 13, 0, 0), datetime.datetime(2009, 12, 20, 0, 0), datetime.datetime(2009, 12, 27, 0, 0), datetime.datetime(2010, 1, 3, 0, 0), datetime.datetime(2010, 1, 10, 0, 0), datetime.datetime(2010, 1, 17, 0, 0), datetime.datetime(2010, 1, 24, 0, 0), datetime.datetime(2010, 1, 31, 0, 0), datetime.datetime(2010, 2, 7, 0, 0), datetime.datetime(2010, 2, 14, 0, 0), datetime.datetime(2010, 2, 21, 0, 0), datetime.datetime(2010, 2, 28, 0, 0), datetime.datetime(2010, 3, 7, 0, 0), datetime.datetime(2010, 3, 14, 0, 0), datetime.datetime(2010, 3, 21, 0, 0), datetime.datetime(2010, 3, 28, 0, 0), datetime.datetime(2010, 4, 4, 0, 0), datetime.datetime(2010, 4, 11, 0, 0), datetime.datetime(2010, 4, 18, 0, 0), datetime.datetime(2010, 4, 25, 0, 0), datetime.datetime(2010, 5, 2, 0, 0), datetime.datetime(2010, 5, 9, 0, 0), datetime.datetime(2010, 5, 16, 0, 0), datetime.datetime(2010, 5, 23, 0, 0), datetime.datetime(2010, 5, 30, 0, 0), datetime.datetime(2010, 6, 6, 0, 0), datetime.datetime(2010, 6, 13, 0, 0), datetime.datetime(2010, 6, 20, 0, 0), datetime.datetime(2010, 6, 27, 0, 0), datetime.datetime(2010, 7, 4, 0, 0), datetime.datetime(2010, 7, 11, 0, 0), datetime.datetime(2010, 7, 18, 0, 0), datetime.datetime(2010, 7, 25, 0, 0), datetime.datetime(2010, 8, 1, 0, 0), datetime.datetime(2010, 8, 8, 0, 0), datetime.datetime(2010, 8, 15, 0, 0), datetime.datetime(2010, 8, 22, 0, 0), datetime.datetime(2010, 8, 29, 0, 0), datetime.datetime(2010, 9, 5, 0, 0), datetime.datetime(2010, 9, 12, 0, 0), datetime.datetime(2010, 9, 19, 0, 0), datetime.datetime(2010, 9, 26, 0, 0), datetime.datetime(2010, 10, 3, 0, 0), datetime.datetime(2010, 10, 10, 0, 0), datetime.datetime(2010, 10, 17, 0, 0), datetime.datetime(2010, 10, 24, 0, 0), datetime.datetime(2010, 10, 31, 0, 0), datetime.datetime(2010, 11, 7, 0, 0), datetime.datetime(2010, 11, 14, 0, 0), datetime.datetime(2010, 11, 21, 0, 0), datetime.datetime(2010, 11, 28, 0, 0), datetime.datetime(2010, 12, 5, 0, 0), datetime.datetime(2010, 12, 12, 0, 0), datetime.datetime(2010, 12, 19, 0, 0), datetime.datetime(2010, 12, 26, 0, 0), datetime.datetime(2011, 1, 2, 0, 0), datetime.datetime(2011, 1, 9, 0, 0), datetime.datetime(2011, 1, 16, 0, 0), datetime.datetime(2011, 1, 23, 0, 0), datetime.datetime(2011, 1, 30, 0, 0), datetime.datetime(2011, 2, 6, 0, 0), datetime.datetime(2011, 2, 13, 0, 0), datetime.datetime(2011, 2, 20, 0, 0), datetime.datetime(2011, 2, 27, 0, 0), datetime.datetime(2011, 3, 6, 0, 0), datetime.datetime(2011, 3, 13, 0, 0), datetime.datetime(2011, 3, 20, 0, 0), datetime.datetime(2011, 3, 27, 0, 0), datetime.datetime(2011, 4, 3, 0, 0), datetime.datetime(2011, 4, 10, 0, 0), datetime.datetime(2011, 4, 17, 0, 0), datetime.datetime(2011, 4, 24, 0, 0), datetime.datetime(2011, 5, 1, 0, 0), datetime.datetime(2011, 5, 8, 0, 0), datetime.datetime(2011, 5, 15, 0, 0), datetime.datetime(2011, 5, 22, 0, 0), datetime.datetime(2011, 5, 29, 0, 0), datetime.datetime(2011, 6, 5, 0, 0), datetime.datetime(2011, 6, 12, 0, 0), datetime.datetime(2011, 6, 19, 0, 0), datetime.datetime(2011, 6, 26, 0, 0), datetime.datetime(2011, 7, 3, 0, 0), datetime.datetime(2011, 7, 10, 0, 0), datetime.datetime(2011, 7, 17, 0, 0), datetime.datetime(2011, 7, 24, 0, 0), datetime.datetime(2011, 7, 31, 0, 0), datetime.datetime(2011, 8, 7, 0, 0), datetime.datetime(2011, 8, 14, 0, 0), datetime.datetime(2011, 8, 21, 0, 0), datetime.datetime(2011, 8, 28, 0, 0), datetime.datetime(2011, 9, 4, 0, 0), datetime.datetime(2011, 9, 11, 0, 0), datetime.datetime(2011, 9, 18, 0, 0), datetime.datetime(2011, 9, 25, 0, 0), datetime.datetime(2011, 10, 2, 0, 0), datetime.datetime(2011, 10, 9, 0, 0), datetime.datetime(2011, 10, 16, 0, 0), datetime.datetime(2011, 10, 23, 0, 0), datetime.datetime(2011, 10, 30, 0, 0), datetime.datetime(2011, 11, 6, 0, 0), datetime.datetime(2011, 11, 13, 0, 0), datetime.datetime(2011, 11, 20, 0, 0), datetime.datetime(2011, 11, 27, 0, 0), datetime.datetime(2011, 12, 4, 0, 0), datetime.datetime(2011, 12, 11, 0, 0), datetime.datetime(2011, 12, 18, 0, 0), datetime.datetime(2011, 12, 25, 0, 0), datetime.datetime(2012, 1, 1, 0, 0), datetime.datetime(2012, 1, 8, 0, 0), datetime.datetime(2012, 1, 15, 0, 0), datetime.datetime(2012, 1, 22, 0, 0), datetime.datetime(2012, 1, 29, 0, 0), datetime.datetime(2012, 2, 5, 0, 0), datetime.datetime(2012, 2, 12, 0, 0), datetime.datetime(2012, 2, 19, 0, 0), datetime.datetime(2012, 2, 26, 0, 0), datetime.datetime(2012, 3, 4, 0, 0), datetime.datetime(2012, 3, 11, 0, 0), datetime.datetime(2012, 3, 18, 0, 0), datetime.datetime(2012, 3, 25, 0, 0), datetime.datetime(2012, 4, 1, 0, 0), datetime.datetime(2012, 4, 8, 0, 0), datetime.datetime(2012, 4, 15, 0, 0), datetime.datetime(2012, 4, 22, 0, 0), datetime.datetime(2012, 4, 29, 0, 0), datetime.datetime(2012, 5, 6, 0, 0), datetime.datetime(2012, 5, 13, 0, 0), datetime.datetime(2012, 5, 20, 0, 0), datetime.datetime(2012, 5, 27, 0, 0), datetime.datetime(2012, 6, 3, 0, 0), datetime.datetime(2012, 6, 10, 0, 0), datetime.datetime(2012, 6, 17, 0, 0), datetime.datetime(2012, 6, 24, 0, 0), datetime.datetime(2012, 7, 1, 0, 0), datetime.datetime(2012, 7, 8, 0, 0), datetime.datetime(2012, 7, 15, 0, 0), datetime.datetime(2012, 7, 22, 0, 0), datetime.datetime(2012, 7, 29, 0, 0), datetime.datetime(2012, 8, 5, 0, 0), datetime.datetime(2012, 8, 12, 0, 0), datetime.datetime(2012, 8, 19, 0, 0), datetime.datetime(2012, 8, 26, 0, 0), datetime.datetime(2012, 9, 2, 0, 0), datetime.datetime(2012, 9, 9, 0, 0), datetime.datetime(2012, 9, 16, 0, 0), datetime.datetime(2012, 9, 23, 0, 0), datetime.datetime(2012, 9, 30, 0, 0), datetime.datetime(2012, 10, 7, 0, 0), datetime.datetime(2012, 10, 14, 0, 0), datetime.datetime(2012, 10, 21, 0, 0), datetime.datetime(2012, 10, 28, 0, 0), datetime.datetime(2012, 11, 4, 0, 0), datetime.datetime(2012, 11, 11, 0, 0), datetime.datetime(2012, 11, 18, 0, 0), datetime.datetime(2012, 11, 25, 0, 0), datetime.datetime(2012, 12, 2, 0, 0), datetime.datetime(2012, 12, 9, 0, 0), datetime.datetime(2012, 12, 16, 0, 0), datetime.datetime(2012, 12, 23, 0, 0), datetime.datetime(2012, 12, 30, 0, 0), datetime.datetime(2013, 1, 6, 0, 0), datetime.datetime(2013, 1, 13, 0, 0), datetime.datetime(2013, 1, 20, 0, 0), datetime.datetime(2013, 1, 27, 0, 0), datetime.datetime(2013, 2, 3, 0, 0), datetime.datetime(2013, 2, 10, 0, 0), datetime.datetime(2013, 2, 17, 0, 0), datetime.datetime(2013, 2, 24, 0, 0), datetime.datetime(2013, 3, 3, 0, 0), datetime.datetime(2013, 3, 10, 0, 0), datetime.datetime(2013, 3, 17, 0, 0), datetime.datetime(2013, 3, 24, 0, 0), datetime.datetime(2013, 3, 31, 0, 0), datetime.datetime(2013, 4, 7, 0, 0), datetime.datetime(2013, 4, 14, 0, 0), datetime.datetime(2013, 4, 21, 0, 0), datetime.datetime(2013, 4, 28, 0, 0), datetime.datetime(2013, 5, 5, 0, 0), datetime.datetime(2013, 5, 12, 0, 0), datetime.datetime(2013, 5, 19, 0, 0), datetime.datetime(2013, 5, 26, 0, 0), datetime.datetime(2013, 6, 2, 0, 0), datetime.datetime(2013, 6, 9, 0, 0), datetime.datetime(2013, 6, 16, 0, 0), datetime.datetime(2013, 6, 23, 0, 0), datetime.datetime(2013, 6, 30, 0, 0), datetime.datetime(2013, 7, 7, 0, 0), datetime.datetime(2013, 7, 14, 0, 0), datetime.datetime(2013, 7, 21, 0, 0), datetime.datetime(2013, 7, 28, 0, 0), datetime.datetime(2013, 8, 4, 0, 0), datetime.datetime(2013, 8, 11, 0, 0), datetime.datetime(2013, 8, 18, 0, 0), datetime.datetime(2013, 8, 25, 0, 0), datetime.datetime(2013, 9, 1, 0, 0), datetime.datetime(2013, 9, 8, 0, 0), datetime.datetime(2013, 9, 15, 0, 0), datetime.datetime(2013, 9, 22, 0, 0), datetime.datetime(2013, 9, 29, 0, 0), datetime.datetime(2013, 10, 6, 0, 0), datetime.datetime(2013, 10, 13, 0, 0), datetime.datetime(2013, 10, 20, 0, 0), datetime.datetime(2013, 10, 27, 0, 0), datetime.datetime(2013, 11, 3, 0, 0), datetime.datetime(2013, 11, 10, 0, 0), datetime.datetime(2013, 11, 17, 0, 0), datetime.datetime(2013, 11, 24, 0, 0), datetime.datetime(2013, 12, 1, 0, 0), datetime.datetime(2013, 12, 8, 0, 0), datetime.datetime(2013, 12, 15, 0, 0), datetime.datetime(2013, 12, 22, 0, 0), datetime.datetime(2013, 12, 29, 0, 0), datetime.datetime(2014, 1, 5, 0, 0), datetime.datetime(2014, 1, 12, 0, 0), datetime.datetime(2014, 1, 19, 0, 0), datetime.datetime(2014, 1, 26, 0, 0), datetime.datetime(2014, 2, 2, 0, 0), datetime.datetime(2014, 2, 9, 0, 0), datetime.datetime(2014, 2, 16, 0, 0), datetime.datetime(2014, 2, 23, 0, 0), datetime.datetime(2014, 3, 2, 0, 0), datetime.datetime(2014, 3, 9, 0, 0), datetime.datetime(2014, 3, 16, 0, 0), datetime.datetime(2014, 3, 23, 0, 0), datetime.datetime(2014, 3, 30, 0, 0), datetime.datetime(2014, 4, 6, 0, 0), datetime.datetime(2014, 4, 13, 0, 0), datetime.datetime(2014, 4, 20, 0, 0), datetime.datetime(2014, 4, 27, 0, 0), datetime.datetime(2014, 5, 4, 0, 0), datetime.datetime(2014, 5, 11, 0, 0), datetime.datetime(2014, 5, 18, 0, 0), datetime.datetime(2014, 5, 25, 0, 0), datetime.datetime(2014, 6, 1, 0, 0), datetime.datetime(2014, 6, 8, 0, 0), datetime.datetime(2014, 6, 15, 0, 0), datetime.datetime(2014, 6, 22, 0, 0), datetime.datetime(2014, 6, 29, 0, 0), datetime.datetime(2014, 7, 6, 0, 0), datetime.datetime(2014, 7, 13, 0, 0), datetime.datetime(2014, 7, 20, 0, 0), datetime.datetime(2014, 7, 27, 0, 0), datetime.datetime(2014, 8, 3, 0, 0), datetime.datetime(2014, 8, 10, 0, 0), datetime.datetime(2014, 8, 17, 0, 0), datetime.datetime(2014, 8, 24, 0, 0), datetime.datetime(2014, 8, 31, 0, 0), datetime.datetime(2014, 9, 7, 0, 0), datetime.datetime(2014, 9, 14, 0, 0), datetime.datetime(2014, 9, 21, 0, 0), datetime.datetime(2014, 9, 28, 0, 0), datetime.datetime(2014, 10, 5, 0, 0), datetime.datetime(2014, 10, 12, 0, 0), datetime.datetime(2014, 10, 19, 0, 0), datetime.datetime(2014, 10, 26, 0, 0), datetime.datetime(2014, 11, 2, 0, 0), datetime.datetime(2014, 11, 9, 0, 0), datetime.datetime(2014, 11, 16, 0, 0), datetime.datetime(2014, 11, 23, 0, 0), datetime.datetime(2014, 11, 30, 0, 0), datetime.datetime(2014, 12, 7, 0, 0), datetime.datetime(2014, 12, 14, 0, 0), datetime.datetime(2014, 12, 21, 0, 0), datetime.datetime(2014, 12, 28, 0, 0), datetime.datetime(2015, 1, 4, 0, 0), datetime.datetime(2015, 1, 11, 0, 0), datetime.datetime(2015, 1, 18, 0, 0), datetime.datetime(2015, 1, 25, 0, 0), datetime.datetime(2015, 2, 1, 0, 0), datetime.datetime(2015, 2, 8, 0, 0), datetime.datetime(2015, 2, 15, 0, 0), datetime.datetime(2015, 2, 22, 0, 0), datetime.datetime(2015, 3, 1, 0, 0), datetime.datetime(2015, 3, 8, 0, 0), datetime.datetime(2015, 3, 15, 0, 0), datetime.datetime(2015, 3, 22, 0, 0), datetime.datetime(2015, 3, 29, 0, 0), datetime.datetime(2015, 4, 5, 0, 0), datetime.datetime(2015, 4, 12, 0, 0), datetime.datetime(2015, 4, 19, 0, 0), datetime.datetime(2015, 4, 26, 0, 0), datetime.datetime(2015, 5, 3, 0, 0), datetime.datetime(2015, 5, 10, 0, 0), datetime.datetime(2015, 5, 17, 0, 0), datetime.datetime(2015, 5, 24, 0, 0), datetime.datetime(2015, 5, 31, 0, 0), datetime.datetime(2015, 6, 7, 0, 0), datetime.datetime(2015, 6, 14, 0, 0), datetime.datetime(2015, 6, 21, 0, 0), datetime.datetime(2015, 6, 28, 0, 0), datetime.datetime(2015, 7, 5, 0, 0), datetime.datetime(2015, 7, 12, 0, 0), datetime.datetime(2015, 7, 19, 0, 0), datetime.datetime(2015, 7, 26, 0, 0), datetime.datetime(2015, 8, 2, 0, 0), datetime.datetime(2015, 8, 9, 0, 0), datetime.datetime(2015, 8, 16, 0, 0), datetime.datetime(2015, 8, 23, 0, 0), datetime.datetime(2015, 8, 30, 0, 0), datetime.datetime(2015, 9, 6, 0, 0), datetime.datetime(2015, 9, 13, 0, 0), datetime.datetime(2015, 9, 20, 0, 0), datetime.datetime(2015, 9, 27, 0, 0), datetime.datetime(2015, 10, 4, 0, 0), datetime.datetime(2015, 10, 11, 0, 0), datetime.datetime(2015, 10, 18, 0, 0), datetime.datetime(2015, 10, 25, 0, 0), datetime.datetime(2015, 11, 1, 0, 0), datetime.datetime(2015, 11, 8, 0, 0), datetime.datetime(2015, 11, 15, 0, 0)]
所有列表(日期列表和列表中的其他列表)将具有相同数量的项目,并且以列表中的第一项与日期列表中的第一项对应的方式正确排序。依此类推。
我的问题是,如何将日期列表和函数返回的列表(可能是许多不确定的数字)组合成一个散点图,其中日期列表为y,列表项为x' s?
答案 0 :(得分:1)
我找到了该功能的选项:
def scatter_lists(list_of_lists,datelist):
"""
:param list_of_lists: lists of lists with inner lists correctly sorted by date and with the right number of items
:param datelist: a list of dates
:return: a scattered chart with all the inputed data
"""
for inner_list in list_of_lists:
newlist=map(lambda x:float(x),inner_list)
newlist=map(lambda x:float(x)/float(max(newlist)),newlist)
plt.scatter(datelist,newlist)
plt.show()
答案 1 :(得分:0)
所以,据我所知:
对于每个内部列表,您希望获取相应的日期,然后根据该日期绘制内部列表的所有值。
利用您可以在显示结果之前多次绘制的事实,并尝试类似:
from matplotlib import pyplot as plt
date_list = [1, 2, 3] # Pretend this has datetimes
nested_list = [[1,2,3], [4,4,4], [7,8,9]]
# Plot multiple scatter data multiple times, then show
for index, inner_list in enumerate(nested_list):
num_items = len(inner_list)
inner_dates = [date_list[i]] * num_items
plt.scatter(inner_dates, inner_list)
plt.show()