tudent_data = data.frame(student_id=c(1:4), student_name=c(‘Ram’,‘Harish’,‘Pradeep’,‘Rajesh’))1 pointChoose the correct command to add a column named student_dept to the dataframe student_data. student_datastudent_dept=c(“Commerce”, “Biology”, “English”, “Tamil”) student_data[“student_dept”]= c(“Commerce”,“Biology”, “English”,“Tamil”) student_dept= student_data[c(“Commerce”,“Biology”,“English”,“Tamil”)] None of the above
Question
tudent_data = data.frame(student_id=c(1:4), student_name=c(‘Ram’,‘Harish’,‘Pradeep’,‘Rajesh’))1 pointChoose the correct command to add a column named student_dept to the dataframe student_data. student_datastudent_dept=c(“Commerce”, “Biology”, “English”, “Tamil”) student_data[“student_dept”]= c(“Commerce”,“Biology”, “English”,“Tamil”) student_dept= student_data[c(“Commerce”,“Biology”,“English”,“Tamil”)] None of the above
Solution
The correct command to add a column named student_dept to the dataframe student_data is:
student_data["student_dept"] = c("Commerce","Biology", "English","Tamil")
Similar Questions
hoose the correct command to access the element Tamil in the dataframe student_data. student_data[[4]] student_data[[4]][3] student_data[[3]][4] None of the above
EasyCompaniesHintWrite a solution to create a DataFrame from a 2D list called student_data. This 2D list contains the IDs and ages of some students.The DataFrame should have two columns, student_id and age, and be in the same order as the original 2D list.The result format is in the following example. Example 1:Input:student_data:[ [1, 15], [2, 11], [3, 11], [4, 20]]Output:+------------+-----+| student_id | age |+------------+-----+| 1 | 15 || 2 | 11 || 3 | 11 || 4 | 20 |+------------+-----+Explanation:A DataFrame was created on top of student_data, with two columns named student_id and
Consider the following DataFrame Gr and answer any four questions from (i)- (v) Name Age0 Rashmi A11 Harsh A22 Ganesh B13 Priya A14 Vivek B25 Anita A26 Karthik A1 5. Write down the command that will give the following output. Name Age0 Rashmi A11 Harsh A22 Ganesh B13 Priya A14 Vivek B2*1 pointa. print(Gr.iloc[0:5])b. print(Gr[0:5])c. Bothd. None6. The teacher needs to add a column called Percentage with the following data [92,89,None,95,68,None,93] Help her to identify the correct set of statement/s from the given options :*1 pointa. Gr.column[‘Percentage’]=[92,89,None, 95,68,None ,93]b. Gr[‘ Percentage’]=[92,89,None, 95,68,None ,93]c. Gr.loc[‘Percentage’]= [92,89,None,95,68,None,93]d. Both (b) and (c) are correct7. Which of the following statement/s will drop the column Grade by name?*1 pointa. Gr.drop[‘Grade’]b. Gr.drop(‘Grade’, axis=1)c. Both a & bd. None of the above8. Which of the following command will display the column labels of the DataFrame?*1 pointa. print(Gr.columns())b. print(Gr.column())c. print(Gr.column)d. print(Gr.Columns)
You need to modify the STUDENTS table to add a primary key on the STUDENT_ID column. The table is currently empty. Which statement accomplishes this task?
Write command to create a dataframe to store marks of 3 subjects . columns can be named as ["GE", "SEC","VAC "]. Rows are indexed by rollno of the students [25,30,50]
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.