Answers for "pandas drop unnamed columns"

3

pandas drop unnamed columns

df = df.loc[:, ~df.columns.str.contains('^Unnamed')]

In [162]: df
Out[162]:
   colA  ColB  colC  colD  colE  colF  colG
0    44    45    26    26    40    26    46
1    47    16    38    47    48    22    37
2    19    28    36    18    40    18    46
3    50    14    12    33    12    44    23
4    39    47    16    42    33    48    38
Posted by: Guest on May-27-2020
4

pandas read_csv ignore unnamed columns

pd.read_csv(file_name, index_col=0)
Posted by: Guest on November-26-2020
1

dropping unnamed columns in pandas

df = df.loc[:, ~df.columns.str.contains('^Unnamed')]

In [162]: df
Out[162]:
   colA  ColB  colC  colD  colE  colF  colG
0    44    45    26    26    40    26    46
1    47    16    38    47    48    22    37
2    19    28    36    18    40    18    46
3    50    14    12    33    12    44    23
4    39    47    16    42    33    48    38
Posted by: Guest on December-04-2020
1

get rid of unnamed column pandas

df.to_csv(path, index=False)
Posted by: Guest on June-10-2020
0

remove unnamed columns pandas

df2.columns.str.match("Unnamed")
df2.loc[:,~df2.columns.str.match("Unnamed")]
Posted by: Guest on February-07-2021

Code answers related to "pandas drop unnamed columns"

Python Answers by Framework

Browse Popular Code Answers by Language