我正在尝试使用mailchimp API 3.0对列表进行排序,但它无法正常工作 这就是我正在做的事情:
$target = 'lists/'.$list_id.'/members?sort_field=members.email_address&sort_dir=ASC'
sort_dir工作正常但我无法在任何地方找到如何正确使用sort_field。
答案 0 :(得分:1)
That particular endpoint似乎不允许排序。 file manager endpoint执行并列出sort_field
作为参数。
答案 1 :(得分:1)
男人,真可惜。我希望对分段列表做同样的事情。
# main_df: main dataframe to transform
# join_df: the dataframe of the join table w values to add to df
# main_index: name of main_df index column
# multi_index: name of column w/ multiple values per main_index, added by merge with join_df
# jointype: type of merge to perform, e.g. left, right, inner, outer
def consolidate(main_df, join_df, main_index, multi_index, jointype):
# merge
main_df = pd.merge(main_df, join_df, on=main_index, how=jointype)
# consolidate
new_df = pd.DataFrame({})
for i in main_df[main_index].unique():
i_rows = main_df.loc[main_df[main_index] == i]
values = []
for column in main_df.columns:
values.append(i_rows[:1][column].values[0])
row_dict = dict(zip(main_df.columns, values))
row_dict[multi_index] = list(i_rows[multi_index])
new_df = new_df.append(row_dict, ignore_index=True)
return new_df
authors = consolidate(authors, plays_authors, 'author_id', 'play_id', 'left')
我最终不得不在PHP中使用数组。
$result = $MailChimp->get('/lists/xxxx/segments?fields=segments.name,segments.id&sort_field=segments.name&sort_dir=ASC');