打印“ EXTERNSHEET(b7-):”熊猫

时间:2020-08-12 02:41:43

标签: python pandas xlrd

我曾经试图像平常一样运行我的图书馆“熊猫”,但后来遇到了一个错误

.prototype

输出

import pandas as pd
df = pd.DataFrame({"city":["losangeles", "losangeles", "newyork"],
                   "beds":[3, 4, 4]})

def growth_factor(city,beds):
    if beds==3:
        if city == 'losangeles'      : return 45
        else: False
    elif beds==4:
        if city == 'losangeles'      : return 47
        elif city == 'newyork'       : return 50
        else: False
    else: False
        
The function should pass into the df and should looks like this:

df=
'city'      | 'beds' | 'growth_factor'
losangeles  |3       | 45
losangeles  |4       | 47
newyork     |4       | 50

我正在使用python 3.7

我再次安装了xlrd,但出现了相同的问题。我该如何解决?谢谢

1 个答案:

答案 0 :(得分:2)

有相同的问题,并使用了建议的修复程序 python3 -m pip install-升级xlrd 即使收到了一些警告也为我工作。

Defaulting to user installation because normal site-packages is not writeable
Collecting xlrd
  Downloading xlrd-1.2.0-py2.py3-none-any.whl (103 kB)
     |████████████████████████████████| 103 kB 6.0 MB/s eta 0:00:01
Installing collected packages: xlrd
ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.

We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.

camelot 12.6.29 requires SQLAlchemy<0.8.0,>=0.7.7, but you'll have sqlalchemy 1.3.14 which is incompatible.
camelot 12.6.29 requires xlrd==0.7.1, but you'll have xlrd 1.2.0 which is incompatible.
Successfully installed xlrd-1.2.0
Note: you may need to restart the kernel to use updated packages.