This is the result of reading the DB I have in Pandas.
bound = pd.read_csv('bound.csv')
bound
I want to make data of (10, 10) into one color, which is (100, 1).
new_bound = pd.concat([bound.Col1, bound.Col2, bound.Col3, bound.Col4, bound.Col5, bound.Col6, bound.Col7, bound.Col8, bound.Col9, bound.Col10], ignore_index=True, axis=0)
I coded it like this and made it into one column...
The DB that I actually have to deal with is a huge (640, 350) piece of data... ㅠ<
So to generalize, I want to make it a For Moon as below.
bound = pd.read_csv('bound.csv')
row, col = bound.shape
new_bound = bound.Col1
for i in range(2, row+1):
new_bound = new_bound.append(bound.Coli)
I want to keep changing the "i" in the append(bound.coli)
What should I do? Help me ㅠ<
python
There is a matrix below.
a,b,c,d,e
1,2,3,4,5
1,2,3,4,5
1,2,3,4,5
Find the transposition matrix for this
0 1 2
a 1 1 1
b 2 2 2
c 3 3 3
d 4 4 4
e 5 5 5
That's what happens.
If you subtract the values of the rows from the transposition matrix obtained in this way,
[1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]
You can get it together,
import pandas as pd
bound = pd.read_csv('sample.csv')
bound_transpose = bound.transpose()
print(bound_transpose)
print([item for row in bound_transpose.get_values() for item in row])
0 1 2
a 1 1 1
b 2 2 2
c 3 3 3
d 4 4 4
e 5 5 5
[1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5]
© 2024 OneMinuteCode. All rights reserved.