Question

In: Computer Science

Assume you have the Pandas DataFrame data, with the following contents: our_columns_name column_A column_B column_C column_D...

Assume you have the Pandas DataFrame data, with the following contents:

our_columns_name column_A column_B column_C column_D column_E

our_index_name                                                   

row_name_0               9        93        71    Hello       102

row_name_1              28        64        37       my        92

row_name_2              13        91        93     name       104

row_name_3              45        29        54       is        74

row_name_4               0        36        31    Jason        36

Each column has a dtype (data type). Which of the following could be set of dtypes for this DataFrame?

Hint 1: None of the numeric values shows a decimal point. (A float shows a decimal point, while an int does not. For example, 3. is a float, while 3 is an int.)

Hint 2: A column that has strings has a dtype of object, not str.

You can create the DataFrame above with this code:

data = pd.DataFrame({'column_A': {'row_name_0': 9,

'row_name_1': 28,

'row_name_2': 13,

'row_name_3': 45,

'row_name_4': 0},

'column_B': {'row_name_0': 93,

'row_name_1': 64,

'row_name_2': 91,

'row_name_3': 29,

'row_name_4': 36},

'column_C': {'row_name_0': 71,

'row_name_1': 37,

'row_name_2': 93,

'row_name_3': 54,

'row_name_4': 31},

'column_D': {'row_name_0': 'Hello',

'row_name_1': 'my',

'row_name_2': 'name',

'row_name_3': 'is',

'row_name_4': 'Jason'},

'column_E': {'row_name_0': 102,

'row_name_1': 92,

'row_name_2': 104,

'row_name_3': 74,

'row_name_4': 36}})

  • A.

    column_A     int64

    column_B   float64

    column_C   float64

    column_D    object

    column_E     int64

  • B.

    column_A     int64

    column_B     int32

    column_C     int32

    column_D    int64

    column_E     int64

  • C.

    column_A     int64

    column_B     int64

    column_C     int64

    column_D    object

    column_E     int64

Solutions

Expert Solution

#option c is correct which is

column_A     int64

column_B     int64

column_C     int64

column_D    object

column_E     int64

#source code in python:

import pandas as pd
data = pd.DataFrame({'column_A': {'row_name_0': 9,

'row_name_1': 28,

'row_name_2': 13,

'row_name_3': 45,

'row_name_4': 0},

'column_B': {'row_name_0': 93,

'row_name_1': 64,

'row_name_2': 91,

'row_name_3': 29,

'row_name_4': 36},

'column_C': {'row_name_0': 71,

'row_name_1': 37,

'row_name_2': 93,

'row_name_3': 54,


'row_name_4': 31},

'column_D': {'row_name_0': 'Hello',

'row_name_1': 'my',

'row_name_2': 'name',

'row_name_3': 'is',

'row_name_4': 'Jason'},

'column_E': {'row_name_0': 102,

'row_name_1': 92,

'row_name_2': 104,

'row_name_3': 74,

'row_name_4': 36}})
print(data.dtypes)

#output:

#if you have any doubt comment below...if you like give thumbs up.....


Related Solutions

Create a pandas dataframe and then impute missing values . data = { 'test' : [1,2,3,4,10,15]...
Create a pandas dataframe and then impute missing values . data = { 'test' : [1,2,3,4,10,15] 'missing' : [1,2,4,None,5,7] } replace the missing values in the missing table column with mean values using mean imputation ============ i am trying like this but i am not getting correct output and getting confused please explain with proper output and explanation import pandas as pd pd.DataFrame(data) temp = pd.DataFrame(data).fillna(np.mean()) temp ['missing'] . fillna(temp['missing'].mean()) ================ i am too much confused please write proper program...
#########################PANDAS LANGUAGE################## #########################MATPLOT LIB######################### # read movie.csv into a DataFrame called 'movie' # describe the dataframe...
#########################PANDAS LANGUAGE################## #########################MATPLOT LIB######################### # read movie.csv into a DataFrame called 'movie' # describe the dataframe #rename the column Runtime (Minutes) with Runtime_Minutes, and Revenue (Millions) with Revenue_Millions # show if any column has null value # count total number of null vlaues in the dataframe # print those rows which has null values # fill null values, #if column is numerical than fill with means (if there is no numerical missing value in #data frame then don't code in...
How do I select every row in pandas dataframe?
How do I select every row in pandas dataframe?
######################LANGUAGE PANDAS#################### #####################MATPLOTLIB########################### ######################################################### # read ufo.csv into a DataFrame called 'ufo' # print the head...
######################LANGUAGE PANDAS#################### #####################MATPLOTLIB########################### ######################################################### # read ufo.csv into a DataFrame called 'ufo' # print the head and the tail # examine the default index, data types, and shape of ufo dataframe # count the number of missing values in each column # count total number of null vlaues in the dataframe # print those rows which has null values # fill null values, #if any column is numerical has null value than fill this column with mean of that column...
######################LANGUAGE PANDAS#################### #####################MATPLOTLIB########################### ######################################################### # read ufo.csv into a DataFrame called 'ufo' # print the head...
######################LANGUAGE PANDAS#################### #####################MATPLOTLIB########################### ######################################################### # read ufo.csv into a DataFrame called 'ufo' # print the head and the tail # examine the default index, data types, and shape of ufo dataframe # count the number of missing values in each column # count total number of null vlaues in the dataframe # print those rows which has null values # fill null values, #if any column is numerical has null value than fill this column with mean of that column...
Using pandas Read in the movies.csv into a dataframe named movies, display the first 5 rows...
Using pandas Read in the movies.csv into a dataframe named movies, display the first 5 rows and answer * Use the filter method to select the column names that contain the exact string facebook [ ] * Use the count method to find the number of non-missing values for each column. [ ] * Display the count of missing values for each column
Analyze used car inventory dataset using Python's pandas library - using DataFrame data structure¶ Dataset: UsedCarInventory_Assignment1.txt...
Analyze used car inventory dataset using Python's pandas library - using DataFrame data structure¶ Dataset: UsedCarInventory_Assignment1.txt (available on Canvas) This dataset shows used cars available for sale at a dealership. Each row represents a car record and columns tell information about each car. The first row in the dataset contains column headers. You must use Pandas to complete all 10 tasks.
Introduction: Assume that you have the following hypothetical data. Use the data to complete the following...
Introduction: Assume that you have the following hypothetical data. Use the data to complete the following requirements. Dataset: Lab 4.sav Requirements: Question 1: Generate the descriptive statistics and perform an appropriate statistical analysis to determine whether state median household income is related with fatality rate across states. a. Report and interpret your statistical results, as well as create tables/figures in accordance with the APA guideline for the professional audience. b. Also, briefly address the results and their impacts written for...
Data on the weights​ (lb) of the contents of cans of diet soda versus the contents...
Data on the weights​ (lb) of the contents of cans of diet soda versus the contents of cans of the regular version of the soda is summarized to the right. Assume that the two samples are independent simple random samples selected from normally distributed​ populations, and do not assume that the population standard deviations are equal. Complete parts​ (a) and​ (b) below. Use a 0.05 significance level for both parts. Diet Regular μ μ1 μ2 n 32 32 x 0.78539...
Data on the weights​ (lb) of the contents of cans of diet soda versus the contents...
Data on the weights​ (lb) of the contents of cans of diet soda versus the contents of cans of the regular version of the soda is summarized to the right. Assume that the two samples are independent simple random samples selected from normally distributed​ populations, and do not assume that the population standard deviations are equal. Complete parts​ (a) and​ (b) below. Use a 0.05 significance level for both parts.                Diet Regular muμ mu 1μ1 mu 2μ2 n 4040...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT