import numpy as np
import pandas as pd
my_array = np.array([[11,22,33],[44,55,66]])
df = pd.DataFrame(my_array, columns = ['Column_A','Column_B','Column_C'])
print(df)
print(type(df))
x = df.to_numpy()
x
DataFrame.to_numpy(dtype=None, copy=False, na_value=<object object>)
# Imports
import numpy as np
import pandas as pd
df= pd.read_csv('/content/drive/MyDrive/Colab Notebooks/res_data/temp/file.txt', header = None, delim_whitespace=True, error_bad_lines=False).to_numpy()
df=df.astype(float) # convert number to float for matric calculations
print(df.shape) # .... (16, 1) initial shaope
df.resize(4, 4)
print(df)
[[ 1. 2. 3. 4.]
[ 5. 6. 7. 8.]
[ 9. 3. 5. 6.]
[ 8. 9. 79. 0.]]