Not applicable to iloc, etc.
There's only pure data, and when it's called in, The top index is 0,1,2,3,4 and not a data value.I want to put the same basic index as .
I can use the header command, is that right?
pandas
>>> import pandas as pd
>>> import numpy as np
>>> df = pd.util.testing.makeDataFrame()
>>> df
A B C D
SIGmzXtCmx 0.470768 -0.807193 0.468051 0.488866
E3IKjzhosa -0.236880 -0.888015 -1.600056 -0.199805
lD7Ht3xkVP -0.193062 0.322076 -1.094081 0.582686
7q5Brj9AeQ -1.361694 -1.420203 -1.140609 -1.733826
Ojwcgiv4n0 -0.727904 -0.149616 0.971487 -0.534119
liAo28WDHV -1.884758 1.971477 -0.435113 -0.373316
ynChzER1cX 1.933783 0.460862 1.399503 0.850038
tkk5R6susD 1.072193 -0.883758 1.023936 -0.336794
DjOYPTEpsQ 0.621182 0.536783 0.800621 0.698601
PwZWRLp0nx -0.773563 -0.621115 -0.731001 -0.550074
aCXd4qbqIE -0.217936 0.402844 -0.182283 0.975230
PwL0VM1tA5 0.658788 1.239632 1.545079 0.493019
4JaTLCc42P 0.816992 0.603847 -0.453202 -1.096263
wYYuleUYGh 0.986658 1.271412 -0.427188 -0.084533
D2Ip7GZsUM 1.206546 -0.844979 -0.486307 -0.245169
CqQuk6SnnD -0.004026 0.224801 0.345854 1.917603
AxdW5Lr344 0.667752 -0.241325 0.831370 -0.746942
BYCczu7eNB -1.308622 -0.761518 -0.618947 0.495343
Red66rCMCD -1.186703 0.771694 -0.973173 -0.295230
W2JwIPenhL 1.140977 -1.138799 -0.900574 2.199128
Rgt6LLWqMJ 1.236587 0.546710 -0.172605 -0.553494
zpoOSKvHL9 -0.124489 0.707197 -0.997226 -1.298666
SHEhdSCuS3 0.287685 -1.249335 -0.415259 -0.156002
xkvdqJFapJ 1.392805 -0.291524 0.464281 0.003749
lnXyD12sVF -1.280195 -2.139832 0.017224 -0.502024
2CTYCniPfH -0.387830 0.960747 -2.074247 0.252334
DWm73dPY4y 0.083914 -0.523869 -0.961064 1.735112
5I3apS1Y3T -0.115769 1.869465 -1.615079 1.480948
i8HWgP7qCy 1.184549 0.086129 -1.461264 1.682370
lHX2TkmWtq 0.792383 1.170700 -0.969357 -0.392937
>>> df = df.set_index(np.array(range(len(df)))+1)
>>> df
A B C D
1 0.470768 -0.807193 0.468051 0.488866
2 -0.236880 -0.888015 -1.600056 -0.199805
3 -0.193062 0.322076 -1.094081 0.582686
4 -1.361694 -1.420203 -1.140609 -1.733826
5 -0.727904 -0.149616 0.971487 -0.534119
6 -1.884758 1.971477 -0.435113 -0.373316
7 1.933783 0.460862 1.399503 0.850038
8 1.072193 -0.883758 1.023936 -0.336794
9 0.621182 0.536783 0.800621 0.698601
10 -0.773563 -0.621115 -0.731001 -0.550074
11 -0.217936 0.402844 -0.182283 0.975230
12 0.658788 1.239632 1.545079 0.493019
13 0.816992 0.603847 -0.453202 -1.096263
14 0.986658 1.271412 -0.427188 -0.084533
15 1.206546 -0.844979 -0.486307 -0.245169
16 -0.004026 0.224801 0.345854 1.917603
17 0.667752 -0.241325 0.831370 -0.746942
18 -1.308622 -0.761518 -0.618947 0.495343
19 -1.186703 0.771694 -0.973173 -0.295230
20 1.140977 -1.138799 -0.900574 2.199128
21 1.236587 0.546710 -0.172605 -0.553494
22 -0.124489 0.707197 -0.997226 -1.298666
23 0.287685 -1.249335 -0.415259 -0.156002
24 1.392805 -0.291524 0.464281 0.003749
25 -1.280195 -2.139832 0.017224 -0.502024
26 -0.387830 0.960747 -2.074247 0.252334
27 0.083914 -0.523869 -0.961064 1.735112
28 -0.115769 1.869465 -1.615079 1.480948
29 1.184549 0.086129 -1.461264 1.682370
30 0.792383 1.170700 -0.969357 -0.392937
© 2024 OneMinuteCode. All rights reserved.