How to rename columns in pandas (Python)?

0 votes

I have a DataFrame and I want to rename columns names:

Example:

["Mist","Dust","Air","Sky"]

to

["Mist1","Dust1","Air1","Sky1"]
Apr 30, 2018 in Data Analytics by DataKing99
• 8,210 points
443 views

1 answer to this question.

0 votes

You can use the rename function in pandas. This function allows you to change the column name in the Pandas data frame.

df.rename(columns={"Mist": "Mist1", "Dust": "Dust1", "Air": "Air1", "Sky": "Sky1"})
answered Apr 30, 2018 by DeepCoder786
• 1,720 points

edited Jun 8 by MD

Related Questions In Data Analytics

0 votes
1 answer
0 votes
1 answer

How to join two tables (tibbles) by *list* columns in R

You can use the hash from digest ...READ MORE

answered Apr 5, 2018 in Data Analytics by kappa3010
• 2,090 points
292 views
0 votes
1 answer
+1 vote
2 answers

How to sort a data frame by columns in R?

You can use dplyr function arrange() like ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 32,490 points
416 views
0 votes
1 answer

What is the Difference in Size and Count in pandas (python)?

The major difference is "size" includes NaN values, ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 8 by Gitika 1,143 views
0 votes
2 answers

Replacing a row in pandas data.frame

key error. I love python READ MORE

answered Feb 18, 2019 in Data Analytics by anonymous
6,473 views
0 votes
1 answer

Converting a pandas data-frame to a dictionary

Emp_dict=Employee.to_dict('records') You can directly use the 'to_dict()' function ...READ MORE

answered May 23, 2018 in Data Analytics by Bharani
• 4,580 points
3,153 views
0 votes
1 answer

Adding values of common columns in pandas dataframe

Result = Set1.add(Set2)   x   y 0  70  ...READ MORE

answered May 30, 2018 in Data Analytics by Bharani
• 4,580 points
235 views
0 votes
7 answers
0 votes
1 answer

How to delete DataFrame row in pandas based upon a column value?

You can use drop function in your ...READ MORE

answered May 3, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 9 by MD 805 views