
- Python 3 Basic Tutorial
- Python 3 - Home
- What is New in Python 3
- Python 3 - Overview
- Python 3 - Environment Setup
- Python 3 - Basic Syntax
- Python 3 - Variable Types
- Python 3 - Basic Operators
- Python 3 - Decision Making
- Python 3 - Loops
- Python 3 - Numbers
- Python 3 - Strings
- Python 3 - Lists
- Python 3 - Tuples
- Python 3 - Dictionary
- Python 3 - Date & Time
- Python 3 - Functions
- Python 3 - Modules
- Python 3 - Files I/O
- Python 3 - Exceptions
How to display Pandas Dataframe in Python without Index?
Use index=False to ignore index. Let us first import the required library −
import pandas as pd
Create a DataFrame −
dataFrame = pd.DataFrame([[10, 15], [20, 25], [30, 35]],index=['x', 'y', 'z'],columns=['a', 'b'])
Select rows by passing label using loc −
dataFrame.loc['x']
Display DataFrame without index −
dataFrame.to_string(index=False)
Example
Following is the code −
import pandas as pd # Create DataFrame dataFrame = pd.DataFrame([[10, 15], [20, 25], [30, 35]],index=['x', 'y', 'z'],columns=['a', 'b']) # DataFrame print"Displaying DataFrame with index...\n",dataFrame # select rows with loc print"\nSelect rows by passing label..." print(dataFrame.loc['x']) # display DataFrame without index print"\nDisplaying DataFrame without Index...\n",dataFrame.to_string(index=False)
Output
This will produce the following output −
Displaying DataFrame with index... a b x 10 15 y 20 25 z 30 35 Select rows by passing label... a 10 b 15 Name: x, dtype: int64 Displaying DataFrame without Index... a b 10 15 20 25 30 35
- Related Articles
- Python Pandas - Display the index of dataframe in the form of multi-index
- Python - Rename column names by index in a Pandas DataFrame without using rename()
- How to reset index in Pandas dataframe?
- Python Pandas - Return Index without NaN values
- Select DataFrame rows between two index values in Python Pandas
- Python Pandas – Display all the column names in a DataFrame
- Python - Display True for infinite values in a Pandas DataFrame
- Python Pandas - Create a DataFrame from original index but enforce a new index
- Python Pandas - Create a DataFrame from DateTimeIndex ignoring the index
- Python Pandas – How to use Pandas DataFrame Property: shape
- Python Pandas – How to use Pandas DataFrame tail( ) function
- Python Pandas - Display specific number of rows from a DataFrame
- Python Pandas – Check and Display row index with infinity
- Python – Drop a level from a multi-level column index in Pandas dataframe
- Python – Drop multiple levels from a multi-level column index in Pandas dataframe

Advertisements