Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

How to pass Dataframe element in function?

$
0
0

@premsheth wrote:

Hi friends,

Need your help again.

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

df['A']
output:
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

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles