小编Kir*_*ain的帖子

Pandas Dataframe 设置类别 - pandas.Categorical.set_categories 中的“inplace”参数已弃用

我的代码中有以下声明:

mcap_summary['cap'].cat.set_categories(['Large','Mid','Small','None'],inplace=True)
Run Code Online (Sandbox Code Playgroud)

现在生成警告为: D:\Python\Python39\lib\site-packages\pandas\core\arrays\categorical.py:2630: FutureWarning: inplacepandas.Categorical.set_categories 中的参数已弃用,并将在未来版本。删除未使用的类别将始终返回一个新的 Categorical 对象。res = 方法(*args, **kwargs)

我应该如何编写才能避免此警告和未来的错误?

提前致谢

python dataframe

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

Selenium ChromeDriverManager Webdriver 安装不通过代理更新

我需要使用 selenium 和 Chrome 使用 python 访问网站。下面是我的代码的缩短版本。

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service

# PROXY='https://myproxy.com:3128'
PROXY = 'https://username:password@myproxy.com:3128'
proxyuser='username' #this is the proxy user name used in above string
proxypwd='password' #this is the proxy password used in above string


chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % PROXY)
chrome_options.add_argument("ignore-certificate-errors");

chrome = webdriver.Chrome(options=chrome_options,service=Service(ChromeDriverManager().install()))

chrome.get("https://www.google.com")
while True:
    print('ok')
Run Code Online (Sandbox Code Playgroud)

我位于需要身份验证的公司代理服务器后面。我不确定如何传递登录凭据和代理设置以安装 chromedriver 当上面的代码在没有代理的情况下运行时,它会按预期工作。但使用代理连接运行时出现如下错误:

[WDM] - ====== WebDriver manager ======
[WDM] - Current google-chrome version is 105.0.5195
[WDM] - Get LATEST chromedriver …
Run Code Online (Sandbox Code Playgroud)

python proxy selenium selenium-webdriver webdriver-manager

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