Как найти локальные максимумы для всех строк данных? - PullRequest
0 голосов
/ 19 января 2020
print(df.head())

enter image description here

from scipy.signal import argrelextrema

ilocs_max = []

for i in range (df.shape[0]):

ilocs_max.append(argrelextrema(df.iloc[i,:].values, np.greater_equal, order=15))

df.iloc[0,:].plot(figsize=(20,8))
df.iloc[3000,:].plot(figsize=(20,8))
df.iloc[3000, [df.loc[3000].tolist()]].plot(style='.', lw=10, color='red', marker="v")

Ответы [ 2 ]

0 голосов
/ 19 января 2020
df.reset_index(drop = True, inplace = True)

max_list = [] 

for i in range(len(df)):
    max_list.append(df.loc[i].max())
0 голосов
/ 19 января 2020

от scipy.signal import argrelextrema

ilocs_max = []

for i in range (df.shape[0]):

ilocs_max.append(argrelextrema(df.iloc[i,:].values, np.greater_equal, order=15))

#Creat a new dataframe of ilocs_max
df1 = pd.DataFrame(ilocs_max)

df.iloc[0,:].plot(figsize=(20,8))
df.iloc[3000,:].plot(figsize=(20,8))
df.iloc[3000, df1.iloc[3000].tolist()].plot(style='.', lw=10, color='red', marker="v"
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...