I have an excel file containing a single column (Row's number is not fixed). Using Python 3, I want to,
- Import my excel file/data in python,
- Read/select the data column (first column), and
- Reshape this column into multiple columns having 10 rows in each column and finally
- Writing output to a new excel file.
I have tried the following code;
import pandas as pd
import numpy as np
df = pd.read_excel('sample.xlsx')
first_column = pd.DataFrame(df.iloc[:,0])
arr = np.array(first_column)
newArr = arr.reshape(10, -1)
However i am facing the following error:
newArr = arr.reshape(arr, (10, -1)) TypeError: only integer scalar arrays can be converted to a scalar index
Looking for someone to help me out achieving this in Python 3.