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 295 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,320 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
4,145 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,970 points
191 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
17,230 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
8,059 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
1,373 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
67,371 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
3,069 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,320 points
301 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,320 points
163 views