简体   繁体   中英

vs code Python extension dataframe not shown in output

I just started using jupyter cells in Visual Studio Code through the Python extension. It is outputting plots fine, but my dataframe is not showing up like the blog example from Microsoft. Below is my code I am running in VS Code:

#%%
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import pandas as pd

x = np.linspace(0, 20, 100)
plt.plot(x, np.sin(x))
plt.show()

#%%
d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d)
df

My output looks like this:

VS Code Cell outputs

I am really excited to use jupyter in VS Code but I need to view the dataframes like in other variable explorers.

I am on windows using Anaconda as my environment.

  • jupyter=1.0.0=py36_7
  • jupyter_client=5.2.3=py36_0
  • jupyter_console=6.0.0=py36_0
  • jupyter_core=4.4.0=py36_0
  • numpy=1.15.4=py36h19fb1c0_0
  • pandas=0.23.4=py36h830ac7b_0

我卸载了Anaconda 3.6,并安装了更新的Anaconda 3.7,现在它可以在VS Code中使用。

That error means we don't have the capability to render the df output for some reason.
The only thing I can think of is you might have a jupyter extension that's modifying the result of a df. (normally it returns an html table to us)

Do you know what jupyter extensions you have installed?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM