top of page

How to Create a Pandas DataFrame with and without a index

  • Writer: Chris Franklin
    Chris Franklin
  • Sep 6, 2022
  • 1 min read

I use pandas often in my fulltime job and in my data science personal projects. Wanted to share how to create a Pandas DataFrame with an index and without a index. With an Index: import pandas as pd testdict ={ "calories":[2,8,9], "food":["chicken","fish","vegetables"], "liquid":["water","gatorade","more water"] } testdf = pd.DataFrame(testdict) testdf Without an index: testdf.style.hide_index()



 
 
 

Recent Posts

See All

Comments


bottom of page