小编use*_*074的帖子

在规范化Pandas数据时加速循环

我有一个pandas数据帧:

|  col1  | heading |
|--------|---------|
|heading1|   true  |
|abc     |  false  |
|efg     |  false  |
|hij     |  false  |
|heading2|   true  |
|klm     |  false  |
|...     |  false  |
Run Code Online (Sandbox Code Playgroud)

这个数据实际上是"顺序的",我想把它转换成这个结构:

|  col1  |  Parent   |
|---------------------
|heading1|  heading1 |
|abc     |  heading1 | 
|efg     |  heading1 |
|hij     |  heading1 |
|heading2|  heading2 |
|klm     |  heading2 |
|...     |  headingN |
Run Code Online (Sandbox Code Playgroud)

我有+ 10M行,所以这个方法需要太长时间:

df['Parent'] = df['col1']

for index, row in df.iterrows():
    if row['heading']:
        current = …
Run Code Online (Sandbox Code Playgroud)

python numpy vectorization pandas

6
推荐指数
2
解决办法
79
查看次数

领英公司供稿

我是LinkedIn公司页面的所有者和管理员:https://www.linkedin.com/company/{id}/

我想连接到LinkedIn,并返回JSON供稿,其中包含公司墙上最新的10条帖子,以显示在我的网站上,因此我触摸了该服务https://api.linkedin.com/v1/companies/{id}/updates?format=json

JSON在中输出linkedin.php。然后,该文件包含在我的网页中,例如index.php

我已经在https://developer.linkedin.com上注册了一个应用程序。我已在https://github.com/ashwinks/PHP-LinkedIn-SDK处提供的PHP-LinkedIn-SDK中输入了我的客户端ID和客户端密钥。

我遵循了需要首先进行身份验证的开发人员文档。当我运行时,linkedin.php我被重定向到登录我的LinkedIn个人资料。我必须完成此步骤才能触摸以上服务。

使用当前的解决方案,我的用户访问我的网站时将必须登录LinkedIn。

如何在不提示用户登录的情况下访问公司的LinkedIn列表?

谢谢。

php linkedin linkedin-api

5
推荐指数
1
解决办法
3028
查看次数

标签 统计

linkedin ×1

linkedin-api ×1

numpy ×1

pandas ×1

php ×1

python ×1

vectorization ×1