Reputation: 1705
Working with Python Pandas 0.19.1.
I'm calling a function in loops, which returns a numeric list with length of 4 each time. What's the easiest way of concatenating them into a DataFrame?
I'm doing this:
result = pd.DataFrame()
for t in dates:
result_t = do_some_stuff(t)
result.append(result_t, ignore_index=True)
The problem is that it concatenates along the column instead of by rows. If dates
has a length of 250, it gives a single-column df with 1000 rows. Instead, what I want is a 250 x 4 df.
Upvotes: 1
Views: 10503