Skip to content
Advertisement

how to avoid row number in read_sql output

When I use pandas read_sql to read from mysql, it returns rows with row number as first column as given below. Is this possible to avoid row numbers?

enter image description here

Advertisement

Answer

You can use False as the second parameter to exclude indexing.

Example

JavaScript

or

JavaScript

Use this function to guide you
JavaScript

You can read more about this here -> Pandas DataFrame: to_csv() function

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement