Skip to content Skip to sidebar Skip to footer

Python Pandas Function Return Multiple Values And Put Them Into Columns

i have two functions as below. The second one works but the first one doesn't work. Why? import pandas as pd df = pd.DataFrame(data = {'a': [1, 2, 3], 'b': [4, 5, 6]}) def add_su

Solution 1:

Update your function such that it returns a pandas Series instead of a python list.

def add_subtract_list(a, b):
  return pd.Series([1,2,3,4])

Post a Comment for "Python Pandas Function Return Multiple Values And Put Them Into Columns"