logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Tracy BartramEnglish
(5/5)

701 Answers

Hire Me
expert
Carson FisherEnglish
(5/5)

721 Answers

Hire Me
expert
Dylan CarsonStatistics
(5/5)

827 Answers

Hire Me
expert
Raymond BarbeauGeneral article writing
(5/5)

702 Answers

Hire Me
Probability
(5/5)

Create a Data frame name as original_df using these values

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

#problem Statement

 

*Create a Data frame (name as "original_df") using these values*

 column name :- [name, age, mobile number, id, gmail, address]

 values : name :- ['vikas', ravtej, uday, vivek, suresh, gnenader]

          age  :- ['24', '24', '24', '23', '30', '25']

  mobile number :-['7839550000', '7839550001', '7839550002', '7839550003', '7839550004', '7839550005']

  id :- ['ctpl0', 'ctpl1', 'ctpl2', 'ctpl3', 'ctpl4', 'ctpl5']

  gmail :- ['v7839550000@ct.com', 'r7839550001@ct.com', 'u7839550002@ct.com', 'v7839550003@ct.com', 's7839550004@ct.com', 'g7839550009@ct.com']

  address :- ['noida', 'noida', 'noida', 'delhi', 'hyderabad', 'hyderabad']

1. Create a new 'df_1' by Filter out "age" column by "24", and print the df_1 (make sure "original_df" remains unchanged).

2. Print "original_df".

3. verify that "id" column has value as "alphanumeric" (using "original_df").

4. Verify that "mobile number" column value is present in corresponding row in "gmail" column , if not then return corresponding "id" value.

5. verify that if "age" column has value as "24" then "address" column has value as "noida", if condition is True return "pass", else return "fail"  

 

 

I Have done half of the code, i got strucked in 3  ponit.

Kindly Help me on this.

 

# Code

 

import pandas as pd

 

# Creating the dataframe

def fun_1():

    original_df = pd.DataFrame(

    {'name': ['vikas', 'ravtej', 'uday', 'vivek', 'suresh', 'gnenader'], 'age': ['24', '24', '24', '23', '30', '25'],

     'mobile_number': ['7839550000', '7839550001', '7839550002', '7839550003', '7839550004', '7839550005'],

     'id': ['ctpl0', 'ctpl1', 'ctpl2', 'ctpl3', 'ctpl4', 'ctpl5'],

     'gmail': ['v7839550000@ct.com', 'r7839550001@ct.com', 'u7839550002@ct.com', 'v7839550003@ct.com',

               's7839550004@ct.com', 'g7839550009@ct.com'],

     'address': ['noida', 'noida', 'noida', 'delhi', 'hyderabad', 'hyderabad']})

     

    return original_df

    

# creating new dataframe

 

def fun_2(df):

    df_1 = df.loc[df['age'] == '24']

    return df_1

    

#verify that "id" column has value as "alphanumeric" (using "original_df")

 

def fun_3():

    check_point = 'pass'

    id = ['ctpl0', 'ctpl1', 'ctpl2', 'ctpl3', 'ctpl4', 'ctpl5']

    for alphanumeric in id:

        if alphanumeric == 'ctpl0':

            pass

        else:

            check_point = 'fail'

    print(check_point)

    return check_point

    

    

 

 

if __name__ == '__main__':

    rs1 = fun_1()

    print(rs1)

    print('******************************************')

    rs2 = fun_2(rs1)

    print(rs2)

    print('******************************************')

    print(rs1)

    print('******************************************')

    rs3 = fun_3()

    print(rs3)

    

 

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme