淡.印象 发表于2022-04-20 15:44
读者您好:
书中源码没有问题,请检查一下您的代码,代码中是否获取了网页地址,完整代码如下:
pandas pd
pd.set_option(, )
df=pd.DataFrame()
url_list=[]
i (1,14):
url=+(i)
url_list.append(url)
url url_list:
df=df.append(pd.read_html(url),=)
(df)
df=df[[x.startswith() x df[3]]]
(df)
df.to_excel(,=[,,,],=)
D:\pycharm_Project_数据分析\venv\Scripts\python.exe D:/pycharm_Project_数据分析/pandas学习/dataframe对象/导入HTML文件.py
D:\pycharm_Project_数据分析\pandas学习\dataframe对象\导入HTML文件.py:11: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
df = df.append(pd.read_html(url),ignore_index=True)
D:\pycharm_Project_数据分析\pandas学习\dataframe对象\导入HTML文件.py:11: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
df = df.append(pd.read_html(url),ignore_index=True)
D:\pycharm_Project_数据分析\pandas学习\dataframe对象\导入HTML文件.py:11: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
df = df.append(pd.read_html(url),ignore_index=True)
D:\pycharm_Project_数据分析\pandas学习\dataframe对象\导入HTML文件.py:11: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
df = df.append(pd.read_html(url),ignore_index=True)
D:\pycharm_Project_数据分析\pandas学习\dataframe对象\导入HTML文件.py:11: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
df = df.append(pd.read_html(url),ignore_index=True)
D:\pycharm_Project_数据分析\pandas学习\dataframe对象\导入HTML文件.py:11: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
df = df.append(pd.read_html(url),ignore_index=True)
D:\pycharm_Project_数据分析\pandas学习\dataframe对象\导入HTML文件.py:11: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
df = df.append(pd.read_html(url),ignore_index=True)
D:\pycharm_Project_数据分析\pandas学习\dataframe对象\导入HTML文件.py:11: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
df = df.append(pd.read_html(url),ignore_index=True)
D:\pycharm_Project_数据分析\pandas学习\dataframe对象\导入HTML文件.py:11: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
df = df.append(pd.read_html(url),ignore_index=True)
D:\pycharm_Project_数据分析\pandas学习\dataframe对象\导入HTML文件.py:11: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
df = df.append(pd.read_html(url),ignore_index=True)
0 1 2 3
1 41 Jaylen Brown, SG Boston Celtics $26,758,928
2 42 DeMar DeRozan, SF Chicago Bulls $26,000,000
3 43 Draymond Green, PF Golden State Warriors $24,026,712
4 44 Nikola Vucevic, C Chicago Bulls $24,000,000
5 45 John Collins, PF Atlanta Hawks $23,000,000
.. ... ... ... ...
479 476 Ryan Arcidiacono, G New York Knicks $546,800
480 477 DeAndre' Bembry, SG Milwaukee Bucks $518,021
481 478 Goran Dragic, PG Brooklyn Nets $460,463
482 479 Jevon Carter, PG Milwaukee Bucks $441,277
483 480 Trendon Watford, PF Portland Trail Blazers $436,482
[440 rows x 4 columns]
D:\pycharm_Project_数据分析\pandas学习\dataframe对象\导入HTML文件.py:11: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
df = df.append(pd.read_html(url),ignore_index=True)
这个返回结果中报错信息太多了