I am using Python and R code with jupyter notebook at the same time. Specifically, I want to use pandas to deal with the data, pass the DataFrame object to R kernal, and then use ggplot2 to visualize it.
However, as long as I pass the pandas DataFrame object to the R kernal, and use ggplot() to make plots,the jupyter notebook will always give a warning as following:
C:\\Study\\Anaconda3-5.2.0\\lib\\site-packages\\rpy2-2.9.4-py3.6-win-amd64.egg\\rpy2\\robjects\\pandas2ri.py:191: FutureWarning: from_items is deprecated. Please use DataFrame.from_dict(dict(items), ...) instead. DataFrame.from_dict(OrderedDict(items)) may be used to preserve the key order. res = PandasDataFrame.from_items(items)
My code is very simple, showing as the following:
%load_ext rpy2.ipython
%R library(ggplot2)
# data_train is a pandas DataFrame object
%%R -i data_train
ggplot(data = data_train,aes(x = factor(Survived))) + geom_bar(fill = "#539bf3")
You could do it directly in python using python ggplot library
Not exactly what you are asking but in case you overlook it
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.