[BangPypers] My querry

Shanki Singh Gandhi ssg.bnv at gmail.com
Tue Sep 24 03:43:37 EDT 2019


On Tue, Sep 24, 2019 at 1:04 PM Bappa Bhalsing via BangPypers <
bangpypers at 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
>
> Replace *df('height') = df['Height(inches)'].map(lambda inches:
round(inches * 0.83322 , 2)) *with below. Should work for you.
*df['height'] = df['Height(inches)'].map(lambda inches: round(inches *
0.83322 , 2))*

*-*Shanki


> Regards,
> Bappa
>
>
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list