Dhiraj Upadhyaya
Dhiraj Upadhyaya

Reputation: 41

Column Names in Pandas (Python)

Python : Pandas : Data Frame : Column Names

I have large number of columns and column names are also very large. I would like to see few columns and rows but view becoming restricted to size of column names. How can I temporarily see dataframe in Python without column names (just display data )

Upvotes: 2

Views: 323

Answers (1)

jezrael
jezrael

Reputation: 862481

Convert DataFrame to numpy array:

print (df.values)

But maybe here is possible select values of columns by positions first by iloc:

print (df.iloc[:, 5:8].values)

Sample:

df = pd.DataFrame(np.random.randint(10, size=(3,10)))
print (df)
   0  1  2  3  4  5  6  7  8  9
0  8  4  9  1  3  7  6  3  0  3
1  3  2  6  8  9  3  7  5  7  4
2  0  0  7  5  7  3  9  3  9  3

print (df.iloc[:, 5:8])
   5  6  7
0  7  6  3
1  3  7  5
2  3  9  3

print (df.iloc[:, 5:8].values)
[[7 6 3]
 [3 7 5]
 [3 9 3]]

Upvotes: 2

Related Questions