我将此代码与我的客户ID和客户密码一起使用:
https://github.com/DEKHTIARJonathan/python3-linkedin/blob/master/examples/oauth2_authentication.py
但是,当在命令行中重新获得URL并将其放入浏览器时,我得到“无效的redirect_uri。此值必须与在API密钥中注册的URL匹配”。
我已使用重定向网址注册了以下内容,以使其正常运行:
http://localhost:8080/code
https://localhost:8080/code/
http://localhost:8080/code/signin-linkedin
https://localhost:8080/code/signin-linkedin
https%3A//locahost%3A8080/code/
Run Code Online (Sandbox Code Playgroud)
登录-linkedin片段来自这里:
linkedin:无效的redirect_uri。该值必须与使用API密钥注册的URL匹配
但是,添加最后一个“ sigin-linkedin”部分并不能缓解问题。
这是我要返回的URL,用#代替我的client_id:
提前致谢。
编辑:
我尝试根据其他帖子添加一些其他网址:
https://appname.auth0.com/login/callback
这是我的代码:
if __name__ == '__main__':
CLIENT_ID = #######
CLIENT_SECRET = ##########
RETURN_URL = 'http://localhost:8080/code/'
authentication = LinkedInAuthentication(
CLIENT_ID,
CLIENT_SECRET,
RETURN_URL,
permissions=['r_basicprofile',
'r_emailaddress',
'rw_company_admin',
'w_share']
)
print(authentication.authorization_url)
application = LinkedInApplication(authentication)
Run Code Online (Sandbox Code Playgroud) 尝试获取df并根据组中的值与组max之间的差异创建新列:
Group Value
A 4
A 6
A 10
B 5
B 8
B 11
Run Code Online (Sandbox Code Playgroud)
最后得到一个新的列"from_max"
from_max
6
4
0
6
3
0
Run Code Online (Sandbox Code Playgroud)
我试过这个但是一个ValueError:
df['from_max'] = df.groupby(['Group']).apply(lambda x: x['Value'].max() - x['Value'])
Run Code Online (Sandbox Code Playgroud)
提前致谢
我有一个数据框,其中有一列,如下所示:
Value
xyz123
123
abc
def
Run Code Online (Sandbox Code Playgroud)
我想删除任何包含数字的行,所以我最终得到一个像这样的数据框:
Value
abc
def
Run Code Online (Sandbox Code Playgroud)
我努力了
df = df[df['Value'].str.contains(r'[^a-z]')]
Run Code Online (Sandbox Code Playgroud)
但我得到了这个错误:
“类型错误:‘方法’对象不可下标”
我有一些看起来像这样的数据,叫做“ test_df”
ID Year Value Value2
0 A 2012 1 4
1 A 2012 2 5
2 A 2013 4 6
3 A 2013 5 7
4 B 2014 6 8
5 B 2014 7 4
6 B 2013 8 8
Run Code Online (Sandbox Code Playgroud)
我希望它看起来像这样:
ID Year Value_avg Value2_avg
A 2012 1.5 4.5
A 2013 4.5 6.5
B 2013 8.0 8.0
B 2014 6.5 6.0
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试按多列分组时,它们最终会按对象分组:
Value_avg Value2_avg
ID Year
A 2012 1.5 4.5
2013 4.5 6.5
B 2013 8.0 8.0
2014 6.5 …Run Code Online (Sandbox Code Playgroud)