Question

Question:- Please create the 5*3 two dimensional data having numerical value by using pandas dataframe (You can give any namee) Is there any way that you can put the restrictions on column wise or row wise to drop the whole column or whole row based

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi, Here is the solution

e) To drop entire row, use dropna() function

example :

 df.dropna() 

To drop entire colum, use dropna() with axis parameter as follows

df.dropna(axis=1)

f) To replace null, you can use fillna()

for example:

consider "Name" is the column in df to be checked for null

df["Name"].fillna("No Name", inplace=True)

 

sample code

import pandas as pd 
data = [["A", None, 10], ["B", "[email protected]", 20], ["C", None, 30], [None, "[email protected]", None], ["D", "[email protected]", 23]] 
df = pd.DataFrame(data, columns=["Name", "email", "age"]) 
print(df) df["Name"].fillna("No Name", inplace=True) 
print(df) print(df.isnull()) 
print(df.dropna()) 
print(df.dropna(axis=1)) 
Add a comment
Know the answer?
Add Answer to:
Question:- Please create the 5*3 two dimensional data having numerical value by using pandas dataframe (You...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (a) Load the data file data/tips.csv into a pandas DataFrame called tips_df using the pandas read_table()...

    (a) Load the data file data/tips.csv into a pandas DataFrame called tips_df using the pandas read_table() function. Check the first five rows. (b) Create a new dataframe called tips by randomly sampling 6 records from the dataframe tips_df. Refer to the sample() function documentation. (c) Add a new column to tips called idx as a list ['one', 'two', 'three', 'four', 'five', 'six'] and then later assign it as the index of tips dataframe. Display the dataframe. (d) Create a new...

  • Lab Exercise #15 Assignment Overview This lab exercise provides practice with Pandas data analysis library. Data...

    Lab Exercise #15 Assignment Overview This lab exercise provides practice with Pandas data analysis library. Data Files We provide three comma-separated-value file, scores.csv , college_scorecard.csv, and mpg.csv. The first file is list of a few students and their exam grades. The second file includes data from 1996 through 2016 for all undergraduate degree-granting institutions of higher education. The data about the institution will help the students to make decision about the institution for their higher education such as student completion,...

  • Python Assignment In this assignment, you will use Pandas library to perform analysis on the dataset stored in the following csv file: breast-cancer-wisconsin.csv. Please write script(s) to do the fol...

    Python Assignment In this assignment, you will use Pandas library to perform analysis on the dataset stored in the following csv file: breast-cancer-wisconsin.csv. Please write script(s) to do the following: 1. Read the csv file and covert the dataset into a DataFrame object. 2. Persist the dataset into a SQL table and a JASON file. • Write the content of the DataFrame object into an SQLite database table. This will convert the dataset into a SQL table format. You can...

  • Please solve only if you know how to do it. Write the code using C++ (not...

    Please solve only if you know how to do it. Write the code using C++ (not Python or Java). Show and explain everything neatly. COMMENTS (7.5% of programming assignment grade): Your program should have at least ten (10) different detailed comments explaining the different parts of your program. Each individual comment should be, at a minimum, a sentence explaining a particular part of your code. You should make each comment as detailed as necessary to fully explain your code. You...

  • Use Random number generator (under Data Analysis) to simulate the following data set. Create 10 c...

    Use Random number generator (under Data Analysis) to simulate the following data set. Create 10 columns, each 20 points long and use the following parameters: Number of variables (10), number of data point (20), Distribution (Normal), Mean (40), Standard Deviation (10), Random seed (1234). The data should be in columns: A,B,C,….,I,J. Randomly pick two columns (say Column B and Column H) and perform 2-sided t-test on these two data columns. Record the P-value and repeat this procedure several times (at...

  • Use Random number generator (under Data Analysis) to simulate the following data set. Create 10 columns, each 20 points...

    Use Random number generator (under Data Analysis) to simulate the following data set. Create 10 columns, each 20 points long and use the following parameters: Number of variables (10), number of data point (20), Distribution (Normal), Mean (40), Standard Deviation (10), Random seed (1234). The data should be in columns: A,B,C,….,I,J. Randomly pick two columns (say Column B and Column H) and perform 2-sided t-test on these two data columns. Record the P-value and repeat this procedure several times (at...

  • 23.4 Project 4: Using Pandas for data analysis and practice with error handling Python Please! 23.4...

    23.4 Project 4: Using Pandas for data analysis and practice with error handling Python Please! 23.4 PROJECT 4: Using Pandas for data analysis and practice with error handling Overview In this project, you will use the Pandas module to analyze some data about some 20th century car models, country of origin, miles per gallon, model year, etc. Provided Input Files An input file with nearly 200 rows of data about automobiles. The input file has the following format (the same...

  • Program in C++ Implement Conway's Game of Life using 2-dimensional arrays. All the tips, tricks, techniques...

    Program in C++ Implement Conway's Game of Life using 2-dimensional arrays. All the tips, tricks, techniques we have been using in class are allowed. Nothing else. The program should read the initial state of the board by reading in "alive" cells from a user input data file. Meaning your program should ask the user the name of the data file. Assume all the other cells are "dead." Make sure to use modular coding techniques. The main program should be pretty...

  • Classification in Python: Classification In this assignment, you will practice using the kNN (k-Nearest Neighbors) algorithm...

    Classification in Python: Classification In this assignment, you will practice using the kNN (k-Nearest Neighbors) algorithm to solve a classification problem. The kNN is a simple and robust classifier, which is used in different applications. The goal is to train kNN algorithm to distinguish the species from one another. The dataset can be downloaded from UCI Machine Learning Repository: https://archive.ics.uci.edu/ml/machine-learning-databases/iris/ (Links to an external site.)Links to an external site.. Download `iris.data` file from the Data Folder. The Data Set description...

  • Using java : In this exercise, you need to implement a class that encapsulate a Grid. A grid is a useful concept in crea...

    Using java : In this exercise, you need to implement a class that encapsulate a Grid. A grid is a useful concept in creating board-game applications. Later we will use this class to create a board game. A grid is a two-dimensional matrix (see example below) with the same number of rows and columns. You can create a grid of size 8, for example, it’s an 8x8 grid. There are 64 cells in this grid. A cell in the grid...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT