How to change columname in a dataframe

+1 vote

How to change column name ina data frame

May 21, 2020 in Big Data Hadoop by anonymous
• 130 points

edited May 21, 2020 by Gitika 595 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, 2020 by MD
• 95,440 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, 2020 in Big Data Hadoop by Saksham Sehrawet
8,139 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
• 65,910 points
1,188 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
25,481 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
• 11,380 points
10,521 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
• 11,380 points
2,165 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
103,811 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,390 points
4,233 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, 2020 in Big Data Hadoop by MD
• 95,440 points
958 views
0 votes
1 answer

How to create a group in Hadoop?

Hi@akhtar, Generally, to create a group in the ...READ MORE

answered Oct 1, 2020 in Big Data Hadoop by MD
• 95,440 points
875 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP