0

I have dataframe like below (got from the other app.).

df = pd.DataFrame({'x':[1,2,3], '@y':[4,5,6]})
df
Out[27]:
   x  @y
0  1   4
1  2   5
2  3   6

my function is below and it can apply to df.x.

def my_func(v):
  return pd.Sereis(v*2)

df.apply(lambda z: my_func(z.x), axis=1)
Out[23]:
    0
0  2
1  4
2  6

But I cannot access df.@y attribute.

df.apply(lambda z: my_func(z.@y), axis=1)

SyntaxError: invalid syntax      

How to access @y?

rootpetit
  • 421
  • 2
  • 10
  • 23

0 Answers0