2

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 )

1
  • df.head().values for a few rows. or df.loc[row_labels, column_labels].values for specific rows / columns. Commented May 9, 2018 at 15:08

1 Answer 1

2

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]]
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.