Looks like this issue has happened before with VSCode not able to display dataframe in the viewer.
This is my error:
Failed to create Data Viewer. Check the Jupyter of the Output window for more info.
The output window is empty and does not provide any error output.
This link here looks like the same issue but it was a while ago and I am seeing the same issue
View dataframe while debugging in VS Code
Steps have I done:
* Restarted VSCode
* Created a New Environment
* Restarted Jupyter
* Moved from python 3.9.6 to 3.10.1
All the changes above did not fix my issue. Here is my current VScode version:
Version: 1.63.2 (user setup)
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-15T09:40:02.816Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19042
OK Update to question. After several VSCode restarts and reinstalling Python. I was able to open Dataframes again on VSCode.
Looks like what breaks the dataframe viewer in VSCode is this script. Once I ran it, I could no longer open dataframes again. Looks like there is something I am doing wrong when I create this dataframe.
#-------
import pandas as pd
import requests
from bs4 import BeautifulSoup
# BeautifulSoup is imported with the name bas4
#import bs4
URL = 'https://www.espn.com/nfl/schedule/_/week/1/year/2020'
# Fetch all the HTML source from the url
response = requests.get(URL)
dflnk = pd.DataFrame(columns=['Description','link'])
soup = BeautifulSoup(response.text, 'html.parser')
links = soup.select('a')
# Print out the result
for link in links:
dlink = link.get_text()
if link.get('href') != None:
if 'https://' in link.get('href'):
print(link.get('href'))
else:
hlink = 'https://www.espn.com' + link.get('href') # Convert relative URL to absolute URL
if 'year' in link.get('href'):
print(dlink)
print(hlink)
dict = {'Description': dlink,'link': hlink}
dflnk = dflnk.append(dict, ignore_index = True)
print('----------------------------') # Just a line break
Basically I am trying to get all the links to all the scores on page.