1

I got an numpy array looking like this:

0.716524    0.76476     0.734421    0.699913
0.708502    0.659577    0.646064    0.693093
0.749121    0.695317    0.675748    0.72938
0.68869     0.711581    0.614649    0.654494
0.651646    0.67847     0.655275    0.63885
0.765029    0.685263    0.646114    0.743514
0.7615      0.76907     0.728695    0.746114
0.682806    0.671888    0.6394      0.677168
...

and want to convert it to a pandas dataframe. I know you can convert one-dimensional arrays with

pd.Dataframe(array, columns=["name"])

But how would I do this in my case? And is it possible to name the columns dynamically if the size varies?

0

1 Answer 1

2

You can use DataFrame constructor and for new columns names if dont know number of them is possible use DataFrame.add_prefix:

pd.Dataframe(array).add_prefix('Name')
0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.