I updated Spyder to 4.0.1 which has a new object explorer, allowing to display arbitrary objects in a tree-like view as well as displaying metadata
Previous versions of Spyder enabled to view Pandas Dataframes in a simple table view when double clicking on the variable in the explorer.
Is there a simple way of accessing this nice old view in Spyder 4.0.1?
(Spyder maintainer here) You need to have Pandas installed in the same Python installation or environment where Spyder is installed. Else Spyder will use the Object explorer to open Dataframes, just as it does with any other kind of Python object.
As per documentation https://www.spyder-ide.org/blog/spyder-variable-explorer/ you can view the dataframe by right clicking on it and selecting the "View with the Object Explorer" option.
Edit: I don't have Spyder 4.0 installed, you can check if this works for you.
Just open up the terminal >> activate the environment that you're working in >> install pandas again. (If you're using conda, install it using conda)
if your like me and just messed up by trying different hotkeys or something just try saving the file and relaunching spyder. (please note this is incase you could see the dataframes in tabular form earlier and it suddenly started displaying it differently.)
Related
I have downloaded Pandas library with pip install pandas through the command prompt, when I try to import pandas as pd PyCharm returns an error : ModuleNotFoundError: No module named 'pandas'
I have tried to uninstall and install again many times but nothing seems to work. Does anybody know a solution to this?
You can try downloading the library from PyCharm settings:
File -> Settings
then, Project: -> Python Interpreter
Click a + sign to the right,
Search for the pandas library,
and finally, press 'Install Package'
I think you have to choose the right python interpreter. Check my screenshot
You likely have multiple copies of Python installed on your system. PyCharm can be configured to use any version of Python on your system, including any virtual environments you've defined. The solution is to match up the version of Python you've installed Pandas into with the version of Python that PyCharm is using to run your code.
There are two places where you specify a Python version. First of all, your Project has a version associated with it. Check the "Python Interpreter" section of the "Project" section of your Preferences for that. That version is used for syntax highlighting, code completion, etc.
By default, the abovementioned Python version will also be used to run your code. But you can change the version of Python that your code is run with by creating or modifying a Run Configuration. To do this, check the menu next to the Run and Debug toolbar buttons near the top-left of your PyCharm window.
When you do get into the Python Interpreter section of the Preferences, you'll find that you can see all of the modules installed for each Python version that PyCharm knows about. You can use this to check to see if Pandas is installed for a particular Python version.
I would suggest you get comfortable with all that I've said above. It will save you many headaches in the future.
I am running a python notebook in VS Code (see image). It runs fine but when I try to inspect a dataframe with the Data Viewer I get:
"Python package 'pandas' is required for viewing data."
The package is installed, otherwise, the code would not work and the data frames would not be present in the variable panel. When I click on "Install" I get: "Error: All data science packages require an interpreter be passed in"
I only have two environments, Anaconda and one created by VS code. I have tried selecting either one and nothing changes, code runs on both and I get the same errors on both.
Any ideas on how to fix this problem?
EDIT: The previous question Viewing data in the VSCode variable explorer requires pandas does not solve my issue. As mentioned above I have selected different environments without fixing it.
EDIT 2: Updating pandas did not fix it either. It was only solved by updating Anaconda, as suggested by Mrinal Roy.
This answer on a similar issue Viewing data in the VSCode variable explorer requires pandas mentioned it was fixed around a year ago.
It seems that the version.release string of pandas I was using includes characters that are not correctly parsed by the extension. They mentioned that it was going to be addressed yesterday in the Insider version. Looking forward to validating.
So, you probably have an older version of Anaconda or VS Code. Otherwise, what version of pandas do you have in both conda environments? VS Code Data Viewer requires pandas package 0.20 or later. Try upgrading it and related packages to the latest and check.
I want to view a pandas dataframe in Spyder's Variable Explorer.
When I click on the dataframe 'Name' in the Variable Explorer window, a series of files are executed (spyder_kernel.py, datapub.py, datapub.py, and serialize.py), which are part of the anaconda package. However, while executing serialize.py, the following message shows up:
serialize_object
buffers.insert(0, pickle.dumps(cobj, PICKLE_PROTOCOL))
OverflowError: cannot serialize a bytes object larger than 4 GiB
The dataframe is also not displayed. Any solution to this? Thanks.
(Spyder maintainer here) The problem you mentioned was fixed in Python 3.4 (according to this answer), which added a new Pickle protocol.
However, this is a bit tricky to solve for us because Spyder and the kernel that powers its IPython console run in different processes and both use Python. We'll address this in Spyder 4 (to be released this year), by detecting if both are running in Python 3.4+ to be able to use the right Pickle protocol.
I'm using Python 3.5 and I was trying to download and use Pillow 4.0.0. I got it through Conda, and it shows in its package menu, as well as the module list in Pycharm. However, even when I have the project interpreter set to anaconda, it will not recognize Pillow at all. I've also given it some time to scan through everything, to see if that would work.
Invalidating the caches and restarting would work. If you want to refresh the Pycharm cache, try going to the far left of PyCharm, and choose [File|Invalidate Caches/Restart...]
My dataframes used to display like this:
Then, one day, I realized the borders were not showing anymore:
I don't know what happened.
I have Python 3.4 which I installed using the Anaconda bundle which comes shipped with Python, pandas, iPython, and Spyder. So, I am accessing iPython through the Spyder environment.
After the problem with the border happened, I uninstalled Anaconda, and installed it again, but I got the same issue.
Any help on this would be greatly appreciated.
This functionality was removed in IPython 3.0.
This was reported to the Anaconda Google groups page in May 2015.
I think you're [were] using an old version of Spyder (2.3.0, 2.3.1 or 2.3.2)
on Windows because support for printing DataFrames as html tables was
removed in recent versions (i.e. since [Spyder] 2.3.3).
I'm sorry we've had to remove it, but it was causing other problems
and (more importantly) it stopped to be supported by IPython 3.0+.
Then more explicitly in a later post:
There is no way to get the functionality mentioned by the OP again because it was removed by IPython in its 3.0 version.