pandas - Python: How to get rid off Default Index in a Dataframe using Python 3 -


i trying read csv file , converting dataframe. here apart columns original columns, getting index column being generated automatically.

                  col1          col2           col3        411580        66349            3            0           402645        66887            8            1           388542        82777            4            1           265353       137481            8            1       

i have huge records in lakhs, , did shuffle , thats why index of different range. here need rid off index. tried options such as:

    df = pd.read_csv("file_name", index=0) 

so column 1 can set index. have other issue in data manipulating, when set of existing column in csv file index.

i tried reindex option. doesn't work. when try display col3, coming below:

    df.col3:                  col3        411580        0           402645        1           388542        1           265353        1      

but want below, without default index:

     col3          0             1             1             1      

i have tried of options mentioned in various other posts, nothing working out. great if helps me.

a series or dataframe both have index. if want values, use .values numpy array or df.col3.tolist() array.

>>> df.col3.values array([0, 1, 1, 1])  >>> df.col3.tolist() [0, 1, 1, 1]  >>> df.col3.values.reshape((len(df.col3), 1)) array([[0],        [1],        [1],        [1]]) 

or want useless dataframe 1 displays want...

>>> pd.dataframe(['']*len(df), index=df.col3, columns=['']) col3   0      1      1      1      

why want dataframe or series without index? answer question may result in actual solution problem.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -