setting column names has no effect
See original GitHub issueI am doing a table join and would like to rename columns in the resulting table acs
afterwards. So I set:
acs.columns = ["chr","start", "end", "rep1", "rep2"]
It allegedly works:
In [11]: acs.columns
Out[11]: ['chr', 'start', 'end', 'rep1', 'rep2']
But not really:
In [12]: acs.head()
Out[12]:
chr start end counts_x counts_y
0 chr1 15765 17765 5 1
...
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Renaming the column names of pandas dataframe is not ...
I am trying to rename the column names but it not working as expected. Code: mapping = {df.columns[0]:'Date', df.columns[1]: ...
Read more >Setting Column Width Has No Effect - DataTables
I explicitly set the column names and widths but there is no effect on the column widths unless I set the CSS of...
Read more >Pandas Change Column Names – 3 Methods
The second way to rename your columns is by setting DataFrame.columns to the list of your new column names. This will completely overwrite...
Read more >Set column names to column value in pandas forloop, add ...
One reason this isn't working is because you are trying to assign a single value to df.columns. If you want to rename a...
Read more >Renaming columns in a Pandas DataFrame | by B. Chen
In data analysis, we may work on a dataset that has no column names or column names contain some unwanted characters (e.g. space), ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@DSLituiev
df = df.rename(columns=dict(zip(df.columns, new_columns)))
, slightly inconvenient but not too bad. dask has a few more things to track than pandas.It looks like this works now?