Note
Pandas (12) 본문
728x90
How to convert a numpy array to a dataframe of given shape?
# Input
ser = pd.Series(np.random.randint(1, 10, 35))
# Solution
df = pd.DataFrame(ser.values.reshape(7,5))
print(df)
'Pandas' 카테고리의 다른 글
Pandas (14) (0) | 2022.08.05 |
---|---|
Pandas (13) (0) | 2022.08.03 |
Pandas (11) (0) | 2022.07.31 |
Pandas (10) (0) | 2022.07.30 |
Pandas (9) (0) | 2022.07.29 |
Comments