如何从对象数组中获取最低和最高元素

时间:2019-12-18 10:47:22

标签: angular typescript angular6

我想从对象数组中获取最低和最高元素。

我尝试了以下代码,但出现错误:

import matplotlib.pyplot as plt
import pandas as pd


df = pd.read_csv(file_string, index_col=0)
plt.plot(df[x], df[y1],markersize=16,'^-')
plt.plot(df[x], df[y2],markersize=14,'v-')

#and so on...

plt.show() 

historyDateTimesNew具有如下数据:

this.oldDatetimeSelection = this.historyDateTimesNew.reduce((a, b) => { return a < b ? a : b; });
this.newDatetimeSelection = this.historyDateTimesOld.reduce((a, b) => { return a > b ? a : b; });

因此,基本上oldDatetimeSelection和newDatetimeSelection的类型为[ {createdOn: "2019-11-14T16:56:59.0166667", createdBy: "abc"} {createdOn: "2019-11-14T16:56:59.0166667", createdBy: "abc"} {createdOn: "2019-12-11T18:54:16.5833333", createdBy: "RefreshSalesforceData"} ] ,所以我想获取oldDatetimeSelection中日期的最小值和newDatetimeSelection中的最大值

0 个答案:

没有答案