如何在Azure B2B和B2C之间进行联合(how to federate between Azure B2B and B2C)
我们正在设计一个应用程序,供客户的员工,他们的一些供应商和消费者使用。 所有这三种类型的用户都将拥有不同的权限集。
我们正在分析Azure AD,发现Azure B2B可以用于员工和供应商,而B2C可以用于消费者。 所以,我们需要它们。 我们可以设置我们的应用程序,以便能够从B2B和B2C进行身份验证吗? 或任何其他建议来实现这一点。
提前致谢
We are designing an application which will be used by client's employee, some of their vendors and consumers as well. All of these three types of user will have the different set of rights.
We were analyzing the Azure AD and found that Azure B2B can be used for employees and vendors whereas B2C can be used for consumers. So, we need both of them. Can we setup our application in such a way that if can authenticate from B2B and B2C both? Or any other suggestion to implement this.
Thanks In Advance
原文:https://stackoverflow.com/questions/43552128
最满意答案
首先找到错过的值,然后将其添加到
fillna
:def f(y): a = list(set(x)-set(y)) a = 1 if len(a) == 0 else a[0] y = y.fillna(a) return (y) df['data'] = df.groupby('group')['data'].apply(f).astype(int) print (df) data group 0 0 1 1 1 1 2 2 1 3 0 2 4 1 2 5 2 2 6 2 3 7 0 3 8 1 3
编辑:
df = pd.DataFrame({'data':[0,1,2,0,np.nan,2,np.nan,np.nan,1, np.nan, np.nan, np.nan], 'group':[1,1,1,2,2,2,3,3,3,4,4,4]}) x = np.array([0,1,2]) print (df) data group 0 0.0 1 1 1.0 1 2 2.0 1 3 0.0 2 4 NaN 2 5 2.0 2 6 NaN 3 7 NaN 3 8 1.0 3 9 NaN 4 10 NaN 4 11 NaN 4
def f(y): a = list(set(x)-set(y)) if len(a) == 1: return y.fillna(a[0]) elif len(a) == 2: return y.fillna(a[0], limit=1).fillna(a[1]) elif len(a) == 3: y = pd.Series(x, index=y.index) return y else: return y df['data'] = df.groupby('group')['data'].apply(f).astype(int) print (df) data group 0 0 1 1 1 1 2 2 1 3 0 2 4 1 2 5 2 2 6 0 3 7 2 3 8 1 3 9 0 4 10 1 4 11 2 4
First find value which miss and then add it to
fillna
:def f(y): a = list(set(x)-set(y)) a = 1 if len(a) == 0 else a[0] y = y.fillna(a) return (y) df['data'] = df.groupby('group')['data'].apply(f).astype(int) print (df) data group 0 0 1 1 1 1 2 2 1 3 0 2 4 1 2 5 2 2 6 2 3 7 0 3 8 1 3
EDIT:
df = pd.DataFrame({'data':[0,1,2,0,np.nan,2,np.nan,np.nan,1, np.nan, np.nan, np.nan], 'group':[1,1,1,2,2,2,3,3,3,4,4,4]}) x = np.array([0,1,2]) print (df) data group 0 0.0 1 1 1.0 1 2 2.0 1 3 0.0 2 4 NaN 2 5 2.0 2 6 NaN 3 7 NaN 3 8 1.0 3 9 NaN 4 10 NaN 4 11 NaN 4
def f(y): a = list(set(x)-set(y)) if len(a) == 1: return y.fillna(a[0]) elif len(a) == 2: return y.fillna(a[0], limit=1).fillna(a[1]) elif len(a) == 3: y = pd.Series(x, index=y.index) return y else: return y df['data'] = df.groupby('group')['data'].apply(f).astype(int) print (df) data group 0 0 1 1 1 1 2 2 1 3 0 2 4 1 2 5 2 2 6 0 3 7 2 3 8 1 3 9 0 4 10 1 4 11 2 4
相关问答
更多-
根据我的理解,您希望"n"每个值均匀分布在按"t"分组的子组中。 我也希望这些"n"不能在这些子组中重复。 考虑到这些假设是正确的, pd.pivot_table似乎是这个用例的一个很好的选择。 这里, "n"下的值构成列名, "t"是分组索引, DF的内容由"v"下的值填充。 稍后堆叠DF同时保留NaN条目并使用.loc访问器填充"t"的相应单元格。 df1 = pd.pivot_table(df, "v", "t", "n", "first").stack(dropna=False).reset_ind ...
-
尝试这个 =REPLACE(VLOOKUP(A2 & "*",$B$2:$B$9,1,0),1,FIND("=",VLOOKUP(A2 & "*",$B$2:$B$9,1,0),1)+3,"")这里“ +3 ”表示“ = ”字符后的三个空格。 根据您的要求更改此设置 ID = Column A Matched ID = Column B New ID = Column C 将此公式粘贴到C列中 Try this =REPLACE(VLOOKUP(A2 & "*",$B$2:$B$9,1,0),1,FIND( ...
-
IMO您应该使用fillna ,因为Index类型不是您传递系列所需的填充值的可接受数据类型。 Index有一个to_series方法: In [13]: d=pd.DataFrame(index=['A','B','C'], columns=['Num','Name'], data=[[1,'Andrew'], [2, np.nan], [3, 'Chris']]) d['Name']=d['Name'].fillna(d.index.to_series()) d Out[13]: Num ...
-
一个解决方案可能只适用于nan索引(参见dataframe boolean indexing ): param = dict(priceA = 3, priceB = 2) #Number of previous values to consider for col in df.columns: for i in df[np.isnan(df[col])].index: #Iterate over nan index _window = df.iloc[max(0,(i-para ...
-
Pandas - 使用相应的id列值填充缺少的列值(Pandas - fill missing column values with corresponding id column values)[2022-06-14]
如果空值为None s或NaN s,我认为你需要: d = themecodes.sort_values('name', na_position='first').set_index('code')['name'].to_dict() themecodes.loc[themecodes['name'].isnull(), 'name'] = themecodes['code'].map(d) 要么: themecodes['name'] = themecodes['name'].combine_first ... -
您可以按索引按降序对数据框进行排序,然后ffill它: import pandas as pd df.sort_index(level = [0,1], ascending = False).ffill() # 0 # Type Year # c 2001 SomeThirdName # b 1997 SomeOtherName # 1992 SomeOtherName # a 1996 ...
-
使用df.max(axis=1) In [1807]: df['c'] = df.max(axis=1) In [1808]: df Out[1808]: a b c 0 1 1 10 1 2 12 12 2 16 13 16 3 9 16 16 或者, assign以返回新的数据帧 In [1812]: df.assign(c=df.max(axis=1)) Out[1812]: a b c 0 1 1 10 1 2 12 ...
-
您可以先reindex() ,然后为列调用ffill() : import pandas as pd df = pd.DataFrame({"A":[10, 20, 30], "B":[100, 200, 300], "C":[100, 200, 300]}, index=[2, 6, 8]) df2 = df.reindex([2,4,6,8,10]) for col in ["A", "B"]: df2[col].ffill(inplace=True) ...
-
如何根据列和数组中的数据填充值?(How to fill values based on data present in column and an array? Pandas)[2024-03-08]
首先找到错过的值,然后将其添加到fillna : def f(y): a = list(set(x)-set(y)) a = 1 if len(a) == 0 else a[0] y = y.fillna(a) return (y) df['data'] = df.groupby('group')['data'].apply(f).astype(int) print (df) data group 0 0 1 1 1 1 2 ... -
Python:根据列/行创建具有填充值的数组(Python: Creation of array with fill values according to column/row)[2023-09-20]
我的第一个想法是创建一个0的“空”数组,然后填充1和2的块。 例如 In [145]: C = np.zeros((10,10), int) In [146]: C[:4,:4]=1 In [147]: C[:4,5:9]=2 In [148]: C Out[148]: array([[1, 1, 1, 1, 0, 2, 2, 2, 2, 0], [1, 1, 1, 1, 0, 2, 2, 2, 2, 0], [1, 1, 1, 1, 0, 2, 2, 2, 2, 0], ...