AttributeError: module 'pandas' has no attribute 'to_clipboard' - python-3.x

I run Windows 10 and have installed Python 3 through Anaconda3. I use Jupyter Notebook.
I run the following command as usual (has run many times without a problem):
import pandas as pd
pd.to_clipboard()
As of a sudden this bizarre error message appeared:
AttributeError: module 'pandas' has no attribute 'to_clipboard'
I googled the error message, and following what I read I did the following:
Searched my C:\ drive for pandas.py files and I deleted them. This did not change anything.
Restarted my Jupyter Notebook. Again this did not work.
Uninstalled pandas and reinstalled them through Anaconda. Again the same behavior is persisting.

The to_clipboard() copies the object to the system clipboard.
So if you hve a dataframe df you can use df.to_clipboard() (with optional parameters) if necessary.
The pd does in fact not have a to_clipboard() attribute/function.

Related

Can't get the Datasets library to install in Python 3

I'm trying to install the datasets package (from Huggingface). Everything seems to be working, but when I try to actually import it
from datasets import load_dataset
I get an error in
import pyarrow
import pyarrow.lib as _lib
Specifically:
ImportError: DLL load failed: The specified procedure could not be found.
I've tried reinstalling it multiple times, through Pip, Pip3, Conda. I tried reinstalling pyarrow. Nothing seems to make it work. That said, the error message was different before.
Interestingly, when I try upgrading Pip, I keep getting
WARNING: Ignoring invalid distribution -yarrow
Any idea what I can do to make it work?
Many thanks

What is causing AttributeError: 'list' object has no attribute 'read' when tying to read in a pdf with Tabula?

I am attempting to use Tabula to pull table information from a pdf and convert it to a pandas dataframe. I have been following the steps in this tutorial:
https://aegis4048.github.io/parse-pdf-files-while-retaining-structure-with-tabula-py
When I try to load the remote PDF into my jupyter notebook with the following code (taken directly from the tutorial):
import tabula
df2 = tabula.read_pdf("https://github.com/tabulapdf/tabula-java/raw/master/src/test/resources/technology/tabula/arabic.pdf")
I get the error:
AttributeError: 'list' object has no attribute 'read'
I have tried to read in pdfs saved locally to my machine and I get the same error. I believe I have successfully installed Java and configured the environment variable correctly, and I have the most recent version of Tabula.
Link to screenshot from my jupyter notebook:
https://www.dropbox.com/s/y44mfzuclihfdau/S_O_Capture_1.PNG?dl=0
Thanks.
Make sure you installed the right tabula package!
If you ran pip3 install tabula, then you installed an imposter!
Run pip3 uninstall tabula to remove it, then run:
pip3 install tabula-py
to install the correct package.

Getting no module named pandas error in airflow even after pandas getting successfully installed

How to resolve the error no module named pandas when one node (in Airflow's DAG) is successful in using it(pandas) and the other is not?
I am unable to deduce as to why I am getting an error no module named pandas.
I have checked via pip3 freeze and yes, the desired pandas version does show up.
I have deployed this using docker on a kubernetes cluster.
Pandas is generally required, and sometimes used in some hooks to return dataframes. Well, it's possible that Airflow was installed with pip and not pip3 possibly being added as a Python 2 module and not a Python 3 module (though, using pip should have installed Pandas when one looks at the setup.py).
Which Operator in your DAG is giving this error?
Do you have any PythonVirtualEnvironmentOperators or BashOperators running python from the command line (and thus possibly not sharing the same environment that you're checking has pandas)?

"DLL load failed: The specified module could not be found" error on using wordcloud in Jupyter notebook

I installed the word cloud library in python to use wordcloud. I am able to successfully use it in all editors like sublime, etc but when I am trying to use it in Jupyter notebook then it is giving me error:
DLL load failed: The specified module could not be found
I have been trying to solve this issue from last 2 days but not getting success. I would appreciate any kind of help.
I too faced this issue.
the problem was when wordcloud is installed it gets python modules and stores in
**C:\Python27\Lib\site-packages** folder (in my case this is the python executable path this may vary for you) so when you import from jupyter it tries to find it in this path , but wordcloud creates one more folder with same name and downloads all wordcloud module in side this , this is one more level in directory so jupyter is unable to find. so the hack what i did is copied all modules from inner wordclod folder to one level outside i.e
copy all from C:\Python27\Lib\site-packages\wordcloud\wordcloud ->
C:\Python27\Lib\site-packages\wordcloud
so this made the trick and no more error.

Anaconda3 libhdf5.so.9: cannot open shared object file [works fine on py2.7 but not on py3.4]

I just tried to use pd.HDFStore in IPython Notebook with a Python 3 kernel (Anaconda 2&3 on Ubuntu 14.04)
import pandas as pd
store = pd.HDFStore('/home/Jian/Downloads/test.h5')
but it throws the following error
ImportError: HDFStore requires PyTables, "libhdf5.so.9: cannot open shared object file: No such file or directory" problem importing
I initially thought it's because pytables is somehow missing, but when I check $source activate py34 and $conda list, pytables 3.2.0 is already installed under anaconda python3 environment.
Also, if I switch to Python 2, for example, $source activate py27 and start ipython notebook, it works properly and no import error is thrown.
I guess that I must miss something for configuring pytables under anaconda python 3 env, but I cannot figure it out. Any help is highly appreciated.
Update:
I just tried on a fresh install of Anaconda3-2.3.0-Linux-x86_64 from official website and it ends up with the same error. When I try $locate libhdf5.so.9 in command line, nothing shows up.
This is a known issue that we are working on. When it is fixed, conda update --all will update the libraries and fix the issue.

Resources