This is my code below
plt.figure(1), plt.subplot(121), df=train.dropna(),
sns.distplot(df['LoanAmount'])
I am getting an error like this
> SyntaxError: can't assign to function call
There are a few things wrong with the code, but I will point out the major points:
plt.figure(1), plt.subplot(121), df=train.dropna(), sns.distplot(df['LoanAmount'])
The commas are interpreted as the line being a tuple, with the equals indicating left and right hand sides, in the same way that
x, y, z = 1, 2, 3
Would be, ie:
plt.figure(1), plt.subplot(121), df =
train.dropna(), sns.distplot(df['LoanAmount'])
. What you probably meant was
plt.figure(1)
plt.subplot(121)
df = train.dropna()
sns.distplot(df['LoanAmount'])
which you could write (not advisable) as
plt.figure(1); plt.subplot(121); df=train.dropna(); sns.distplot(df['LoanAmount'])
The main error you see is correct, you can't have a line like
a() = b
That assigns to a function call (it would have no meaning), which you do in the original interpretation.
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.