TypeError: distplot() got an unexpected keyword argument 'x' (or 'hue') - data-visualization

I get the error when I try and plot this-
sns.distplot(X_train, x='Age') #Age is a feature in X_train
I get a similar error when I try and add the hue parameter in there
sns.distplot(X_train['Age'], hue=y_train)
TypeError: distplot() got an unexpected keyword argument 'hue'
What am I doing wrong? Here is where I am trying out the code from-
https://seaborn.pydata.org/tutorial/distributions.html

If someone comes across this same issue, here's what lead to the confusion. Thanks #user2864740
sns.distplot() is deprecated.
sns.displot() is the new function with hue and x parameters.
If you get this error, update your seaborn version. In cmd -
pip install seaborn --upgrade
From inside a notebook, add an ! before pip

Related

TypeError: __init__() got an unexpected keyword argument 'logdir'

I'm new for NLP.I encounter the issue,as follows:
'''TypeError: init() got an unexpected keyword argument 'logdir''''
How can I solve this issue?
We could have done detailed investigation if you had provided some code.
Anyways, for Tensorboard, hyper-parameter logdir and log_dir are used at different situation.
Refer the below links for detailed understanding and use it accordingly.
logdir
log_dir

Cannot write pandas DataFrame to csv: __init__() got an unexpected keyword argument 'tupleize_cols'

I'm running the following basic code:
dfMain.to_csv('./January_filtered_International_WE.csv')
which used to run normally until yesterday. This morning I upgraded to pandas 0.25.0 while running code and now I cannot write my 500k rows dataframe to a csv. I can mention that I left Jupyter Notebook running in order to do some processing, so this morning when I opened it I had the dataFrame already, processed.
Versions (using Windows 10)
Jupyter notebook : 5.7.8
Python : 3.6.7
Pandas : 0.25.0
I would like to save my DataFrame in a fast and efficient manner as I will load it several times in the future. I do not want to close the notebook as this will delete the dataFrame.
I tried:
downgrading to Pandas 0.24.2 (previous version used) but still getting the __init__() got an unexpected keyword argument 'tupleize_cols'
use pd.to_pickle but got a memoryError
use pd.to_hdf but got a memoryError
using msgbox instead but apparently it does not support DataFrames (got an error)
upgrade Jupyter notebook, but got the following error:
ERROR: ipython 5.8.0 has requirement prompt-toolkit<2.0.0,>=1.0.4, but
you'll have prompt-toolkit 2.0.9 which is incompatible
so naturally I did pip install prompt-toolkit 1.0.16 but then got this message:
ERROR: jupyter-console 6.0.0 has requirement prompt-toolkit<2.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.16 which is incompatible.
As an alternative I went into PyCharm and took a random DataFrame.to_csv and it worked. This makes me think the issue is with Jupyter Notebook.
Any help on how to save the DataFrame (~12 GB) is appreciated!
Re-installing Jupyter did the trick in my case
I kept getting the same error, but updating Jupyter fixed it

TypeError: Value passed to parameter 'begin' has DataType float32 not in list of allowed values: int32, int64

when i am cropping image got by tensorflow object detection API but getting this error
TypeError: Value passed to parameter 'begin' has DataType float32 not in list of allowed values: int32, int64
I am using cropped_image= tf.image.crop_to_bounding_box(image_np, int(yminn), int(xminn), int(ymaxx-yminn), int(xmaxx-xminn))
Please Help
i had this exact problem yesterday. This seems to have started as i had installed tensorflow and anaconda together on windows seperately initially. But at one point i tried again install tensorflow using conda create in anaconda command prompt. If you want to save time, just go ahead uninstall and re-install tensorflow, conda (if installed), pythong

Plotting Method error using PyPlot in IJulia

I am trying to plot a function using PyPlot on an IJulia notebook, but I keep obtaining error messages.
When I ran this code:
function gtest2(x)
6.34*(log2(1+exp(10.0*(x+0.5))))^0.8
end
using PyPlot
x = -1.0:0.1:1.0;
plot(x, gtest2(x));
I got errors like these:
MethodError: no method matching ^(::Array{Float64,1}, ::Float64)
Closest candidates are: ^(::Float64, ::Float64) at math.jl:355 ...
I tried to defined a different type of variable while defining my function using gtest2(x::Number) or gtest2(x::Float64) but I have the same errors.
It does the same using linespace instead of -1.0:0.1:1.0. I understand that the format the function sees in input does not match the definition but I don't get what I'm doing wrong because simple functions work:
function f(x)
x
end
plot(x,f(x))
Why am I getting those errors in the first case?
I am using IJulia notebook 0.5.1 on safari.
Your code doesn't properly handle vectors thus you need to either change gtest
using the . vectorization syntax
function gtest2(x)
6.34*(log2.(1 + exp.(10.0*(x + 0.5)))).^0.8
end
or even easier use the dot vectorization as follows
plot(x, gtest2.(x));
To learn more about dot vectorization please see the following in the docs: https://docs.julialang.org/en/latest/manual/functions.html#man-vectorized-1
The first definition works also with:
map(gtest2, x)
or
gtest2.(x)

Error when using PyPlot in Julia

I've studied Julia for several months and I am not an expert in programming. Recently, I re-installed Windows on my laptop and re-installed Julia, Anaconda(for python 3) and Atom, so far.
In Julia, I installed PyPlot.jl by Pkg.add("PyPlot") and want to test plotting with PyPlot. So, I put using PyPlot in Julia and it give an error during initialization of module PyPlot. I've got the following error message:
ERROR conda.core.link:_execute_actions(330): An error occurred while installing package 'defaults::qt-5.6.2-vc9_3'.
UnicodeDecodeError('utf8', ' 1\xb0\xb3 \xc6\xc4\xc0\xcf\xc0\xcc \xba\xb9\xbb\xe7\xb5\xc7\xbe\xfa\xbd\xc0\xb4\xcf\xb4\xd9.\r\n', 9, 10, 'invalid start byte')
Attempting to roll back.
UnicodeDecodeError('utf8', ' 1\xb0\xb3 \xc6\xc4\xc0\xcf\xc0\xcc \xba\xb9\xbb\xe7\xb5\xc7\xbe\xfa\xbd\xc0\xb4\xcf\xb4\xd9.\r\n', 9, 10, 'invalid start byte')
Please let me know how I can solve the problem.
I solved the problem myself by using python in Anaconda.
ENV["PYTHON"]="C:/ProgramData/Anaconda3/python"
In the double quotation marks, put the location of the python which is installed by Anaconda.
After that, apply
Pkg.build("PyCall")
Pkg.build("PyPlot")
I now can use PyPlot using PyPlot as before. It seems there was some problem to use python included in Julia.