1

As array shown below, i want convert into two pandas datarame columns so that i can send to csv file.

I tried using different function like concat, to_array, but didn't help.

Any help is greatly appreciated.

Thanking in advance.

array([2.47286323, 2.59804292, 3.14455557, ..., 1.6698064 , 1.29305288,
   1.06400106])

array([2.47496667, 2.62663333, 2.8342    , ..., 1.57346667, 1.65933333,
   1.1637    ])

2 Answers 2

1
array1 = np.array([1, 2])
array2 = np.array([3, 4])
df = pd.DataFrame(data={"column1":array1, "column2":array2})
Sign up to request clarification or add additional context in comments.

Comments

0

exan`s answer is already sufficient. Nevertheless a different way would be:

import pandas as pd
import numpy as np

a1 = np.array([2.47286323, 2.59804292, 3.14455557, 1.6698064, 1.29305288, 1.06400106])
a2 = np.array([2.47496667, 2.62663333, 2.8342, 1.57346667, 1.65933333, 1.1637])

df = pd.DataFrame()
df["col1"] = a1
df["col2"] = a2

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.