小编Ane*_*esh的帖子

diff()的熊猫反转

我已经改变了值,但是我无法使用diffinv()来区别它

    ds_sqrt=np.sqrt(ds)
    ds_sqrt=pd.DataFrame(ds_sqrt)
    ds_diff=ds_sqrt.diff().values
Run Code Online (Sandbox Code Playgroud)

谁能说出如何与众不同?

python arrays numpy python-3.x

5
推荐指数
3
解决办法
2379
查看次数

IF else 和 for 循环在一行中

我需要在单行中应用 if else 条件和 for 循环。我需要一次更新“RL”和“RM”并将其他值更新为“其他”。怎么做??。有可能吗??

train['MSZoning']=['RL' if x=='RL' else 'Others' for x in train['MSZoning']]
Run Code Online (Sandbox Code Playgroud)

python-3.x pandas scikit-learn sklearn-pandas

4
推荐指数
1
解决办法
2610
查看次数

找不到已解决的包

当我尝试执行时conda env create -f virtual_platform_windows.yml 它显示

ResolvePackageNotFound:
  - pytorch==0.1.12=py35_0.1.12cu80
Run Code Online (Sandbox Code Playgroud)

我尝试为 Windows 安装 pytorch,但仍然出现错误。如何解决这个问题?

virtualenv python-3.x anaconda pytorch

2
推荐指数
1
解决办法
3万
查看次数

Youtube用硒刮:没有得到所有评论

我试图使用selenium与python刮取youtube评论.下面是只删除一个注释并抛出错误的代码

driver = webdriver.Chrome()
url="https://www.youtube.com/watch?v=MNltVQqJhRE"
driver.get(url)

wait(driver, 5500)

driver.execute_script("window.scrollTo(0, document.body.scrollHeight + 500);")
driver.implicitly_wait(5000)

#content = driver.find_element_by_xpath('//*[@id="contents"]')
comm=driver.find_element_by_xpath('//div[@class="style-scope ytd-item-section-renderer"]')
comm1=comm.find_elements_by_xpath('//yt-formatted-string[@id="content-text"]')
#print(comm.text)
for i in range(50):
    print(comm1[i].text,end=' ')
Run Code Online (Sandbox Code Playgroud)

这是我得到的输出.如何获得该页面上的所有评论??? 谁能帮我这个.

 Being a sucessful phyton freelancer really mean to me because if I able to make $2000 in month I can really help my family financial, improve my skill, and have a lot of time to refreshing. So thanks Qazi, you really help me :D 

Traceback (most recent call last):
  File "C:\Python36\programs\Web scrap\YT_Comm.py", …
Run Code Online (Sandbox Code Playgroud)

python selenium python-3.x

0
推荐指数
1
解决办法
624
查看次数