error using simple kdeplot example from the doc - jupyter-notebook

I want to execute the following example from the doc in a jupyter notebook : https://seaborn.pydata.org/generated/seaborn.kdeplot.html
tips = sns.load_dataset("tips")
sns.kdeplot(data=tips, x="total_bill", hue="time")
But I get an error :
ValueError: could not convert string to float: 'Sun'
I use seaborn 0.10.1 and python 3.8.3
It works when I use :
tips = sns.load_dataset("tips")
sns.kdeplot(data=tips.total_bill)
But in this case, I can't use hue with the time column.

I fixed it by upgrading seaborn to 0.11 using :
pip install seaborn --upgrade
With conda, the version didn't upgrade after 0.10.1

Related

Conversion 'py2rpy' not defined for objects of type '<class 'str'>'

I am trying to run R in a google collab notebook (which worked fine before, however as I now tried to access it and run it it keeps giving me an error).
I have ran the following:
%load_ext rpy2.ipython
%%R
install.packages('rworldmap')
install.packages('classInt')
install.packages('reshape2')
install.packages('dplyr')
install.packages('ggpubr')
NotImplementedError: Conversion 'py2rpy' not defined for objects of type '<class 'str'>'
I have tried re-opening the notebook or creating a new one but I keep having the same issue.
This is a problem with newer versions. You must downgrade rpy: run in a cell:
!pip install rpy2==3.5.1
restart and try again
From this post.
It would be best if you first uninstalled the currently loaded rpy2 package:
!pip uninstall rpy2 -y
Then install an older version of rpy2 (3.0.0, works for me):
!pip install rpy2==3.0.0
Use magic commands and enjoy R&python interactively:
%load_ext rpy2.ipython
Example:
%%R
x<-1:5
x

Frappe installation error "AttributeError: module 'pyparsing' has no attribute 'downcaseTokens'"

When I install frappe ( version-13 ) on linux
when I run bench init
it gives an error
ERROR: httplib2 0.20.1 has requirement pyparsing<3,>=2.4.2, but you'll have pyparsing 3.0.0 which is incompatible.
though the installation goes through.
After that when a new site is created it gives an error
AttributeError: module 'pyparsing' has no attribute 'downcaseTokens
which is a deprecated function not available in version 3.0 but available in 2.4.2
How do I get around this issue ? Can I force install an earlier version of pyparsing ?
Regards
Hari
That python package is using a deprecated function in pyparsing.
you can force install any version of a python module as,
pip install pyparsing==2.4.2
well I think I found a Fix for the one's who wants to use the current version of Pyparsing itself. The base package that it creating a problem is httplib2. so in order to rectify you need to update the httplib2 package.
pip install httplib2
I had issues with importing tf_slim package and got the same error !
$ pip install httplib2
This will resolve the "AttributeError: module 'pyparsing' has no attribute 'downcaseTokens'" error.

Getting Altair to work with Jupyter Notebook

Trying to get Altair to work with Jupyter Notebook, I installed it using
conda install -c conda-forge altair vega_datasets notebook vega
But when I try to do an example plot
import altair as alt
from vega_datasets import data
# for the notebook only (not for JupyterLab) run this command once per session
alt.renderers.enable('notebook')
iris = data.iris()
alt.Chart(iris).mark_point().encode(
x='petalLength',
y='petalWidth',
color='species'
)
as seen in their quick start guide, I get
ValueError:
To use the 'notebook' renderer, you must install the vega package
and the associated Jupyter extension.
See https://altair-viz.github.io/getting_started/installation.html
for more information.
even though I have installed vega using Conda. I can make vega example plots though. I am unable to enable the Jupyter extension though, as Jupyter says it is incompatible.
Any help is appreciated.
For the current release of altair (Version 2.2), use
conda install -c conda-forge vega=1.3
or
pip install vega==1.3
and then restart the notebook.
The vega python extension was mistakenly updated this week to only support vega-lite 3.0, which is not yet released and thus not yet supported by Altair.
See https://github.com/altair-viz/altair/issues/1114 for the initial bug report.

How to install Evernote SDK for Python

I'm trying to get started with the Evernote SDK for python. I'm following the quick-start guide here:
https://dev.evernote.com/doc/start/python.php
I'm running into 2 errors:
1. When I try the first command "python setup.py install" I get this error message:
File "setup.py", line 22
packages=find_packages('lib',exclude=[".thrift", ".thrift.", "thrift.", "thrift"]),
SyntaxError: keyword argument repeated
When I try "pip install evernote" I get:
Collecting evernote
Could not find a version that satisfies the requirement evernote (from versions: )
No matching distribution found for evernote
Any help would be much appreciated. Cheers
Update:
It turns out I was using an old version of pip, which was causing the problem. I had to use "sudo -H pip uninstall pip" and then reinstall the latest version for some reason.
"pip install evernote" worked after that.

ERROR:root:Cell magic `%%R` not found

I have python 3 env
installed rpy2 with
conda install -c r rpy2=2.8.5
load the cell magic in jupyter notebook with
%load_ext rmagic
when I try to use R block in notebook, it gives me the error
ERROR:root:Cell magic `%%R` not found.
In a terminal:
pip install rpy2
In a notebook:
%load_ext rpy2.ipython
Then you can use %%R:
%%R
var <- c(1, 2, 3)
This is a link to the best answer I have found to the problem given on this thread:
R Notebook.
This link states that the error means that R is not configured in your DSS instance.
You need to install R manually.
The commands given on the forum post are:
Install the R packages RJSONIO and HTTR in any R console.
Install the Python package rpy2:
pip install rpy2
Afterward, they give the following link:
configure R.
I hope this is helpful and well worded.

Resources