Answers for "set a column as an index pandas"

1

define a column as index pandas

myDataFrame.set_index('column_name')
Posted by: Guest on March-12-2021
0

set column as index

>>> df = df.set_index('Identifier')
>>> df.head()
                Place of Publication Date of Publication  
206                           London         1879 [1878]
216         London; Virtue & Yorston                1868
218                           London                1869
472                           London                1851
480                           London                1857

                        Publisher  
206              S. Tinsley & Co.
216                  Virtue & Co.
218         Bradbury, Evans & Co.
472                 James Darling
480          Wertheim & Macintosh

                                                        Title     Author  
206                         Walter Forbes. [A novel.] By A. A      A. A.
216         All for Greed. [A novel. The dedication signed...  A., A. A.
218         Love the Avenger. By the author of “All for Gr...  A., A. A.
472         Welsh Sketches, chiefly ecclesiastical, to the...  A., E. S.
480         [The World in which I live, and my place in it...  A., E. S.

                                                   Flickr URL
206         http://www.flickr.com/photos/britishlibrary/ta...
216         http://www.flickr.com/photos/britishlibrary/ta...
218         http://www.flickr.com/photos/britishlibrary/ta...
472         http://www.flickr.com/photos/britishlibrary/ta...
480         http://www.flickr.com/photos/britishlibrary/ta...
Posted by: Guest on May-19-2021
5

how to change index in dataframe python

index = [1,2]
df.index = index
Posted by: Guest on April-23-2020

Code answers related to "set a column as an index pandas"

Python Answers by Framework

Browse Popular Code Answers by Language