How to change columname in a dataframe

+1 vote

How to change column name ina data frame

May 20 in Big Data Hadoop by anonymous
• 130 points

edited May 21 by Gitika 120 views

1 answer to this question.

0 votes

Hi@shanmugam,

You can change your column by using rename function. I have attached one example below for your reference.

import pandas as pd
df = pd.read_csv('marks.csv')
df
     Distance      Price
0     2                  20
1     4                  40
2     7                  70
3     9                  90
df.rename(columns={'Distance':'dist','Price':'pri'})
     dist                pri
0     2                  20
1     4                  40
2     7                  70
3     9                  90
answered May 21 by MD
• 24,500 points

Related Questions In Big Data Hadoop

0 votes
2 answers

How to change the location of a table in hive?

Changing location requires 2 steps: 1.) Change location ...READ MORE

answered Feb 12 in Big Data Hadoop by Saksham Sehrawet
875 views
0 votes
1 answer

How to change the default value and to alter a column in sql?

Hi, You can try this: ALTER TABLE foobar_data CHANGE ...READ MORE

answered Jun 24, 2019 in Big Data Hadoop by Gitika
• 29,690 points
52 views
0 votes
7 answers

How to run a jar file in hadoop?

I used this command to run my ...READ MORE

answered Dec 10, 2018 in Big Data Hadoop by Dasinto
9,490 views
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,920 points
5,111 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,920 points
731 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyF ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
30,392 views
–1 vote
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,310 points
1,905 views
+1 vote
2 answers

How to find previous records from a data set in Pig??

Hi, You can use ToDate() and SubtractDuration() function ...READ MORE

answered Jan 23 in Big Data Hadoop by MD
• 24,500 points
102 views
0 votes
1 answer

How to run Hadoop in Docker containers?

Hi, You can run Hadoop in Docker container. Follow ...READ MORE

answered Jan 24 in Big Data Hadoop by MD
• 24,500 points
323 views