How to pass Dataframe element in function?



Hi friends,

Need your help again.

df = pd.DataFrame({"A": ['I love cooking'], "B": [['cooking','rowing']]})
          A	                 B
0	I love cooking	[cooking, rowing]

0 I love cooking
Name: A, dtype: object

Now I want to use df['A'] as input in user define function but it gives me error:
'Series' object has no attribute 'split'

if I write manually in function input it works but when I try to pass dataframe element it gives me error

How can I pass element in function?

I tried pandas’s to_string() function, astype() function but no luck

if someone know how can I use direct element in function please let me know.

Thanks in Advance


Friends From some research I got answer

if we need to find row location there is command called iloc() so I used like follow:


for first element of row