On Tue, Sep 24, 2019 at 1:03 PM Bappa Bhalsing via BangPypers <
bangpypers@python.org> wrote:

> Hello All,
> I am trying to run following program using python and i am getting error
> consistently.
> Please to resolve.
> input_file = '.\Desktop\height-weight.csv'import pandas as pd
> from pandas import DataFrame as df
> df = pd.read_csv(input_file)df.head()
> o/p is OK
> df('height') = df['Height(inches)'].map(lambda inches: round(inches *
> 0.83322 , 2))df.head()
> getting following errorFile "<ipython-input-9-2a96b594216d>", line 1
>     df('height') = df['Height(inches)'].map(lambda inches: round(inches *
> 0.83322 , 2)),
>
>               ^
> SyntaxError: can't assign to function call
>

I think you should use:
    df['height'] = ..
Instead of:
    df('height') = ...

[] are used for accessing elements of a collection where as () is for
function call.

Also, please be careful when adding code to in the emails. Make sure the
code is well structured or use some kind of pastebin and share a link to
it.
In the code that you shared above, multiple lines got mixed up and it is
hard for anyone to read and try it out.

Best,
Anand
_______________________________________________
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers

Reply via email to