
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10744 Articles

AmitDiwan
423 Views
When it is required to convert a three dimensional matrix into a co-ordinate list, the ‘zip’ method, and a list comprehension are used.ExampleBelow is a demonstration of the same −my_list_1 = [[['He', 'Wi'], ['llo', 'll']], [['Pyt', 'i'], ['hon', 'sFun']], [['Ho', 'g'], ['pe', 'ood']]] print("The list is : ") print(my_list_1) ... Read More

AmitDiwan
295 Views
When it is required to perform cross pairing in a list of tuples, the ‘zip’ method, a list comprehension and the ‘==’ operator is used.ExampleBelow is a demonstration of the same −my_list_1 = [('Hi', 'Will'), ('Jack', 'Python'), ('Bill', 'Mills'), ('goodwill', 'Jill')] my_list_2 = [('Hi', 'Band'), ('Jack', 'width'), ('Bill', 'cool'), ('a', ... Read More

AmitDiwan
2K+ Views
We will group Pandas DataFrame using the groupby(). Select the column to be used using the grouper function. We will group day-wise and calculate sum of Registration Price with day interval for our example shown below for Car Sale Records.Set the frequency as an interval of days in the groupby() ... Read More

AmitDiwan
502 Views
To group columns in Pandas dataframe, use the groupby(). At first, let us create Pandas dataframe −dataFrame = pd.DataFrame( { "Car": ["Audi", "Lexus", "Audi", "Mercedes", "Audi", "Lexus", "Mercedes", "Lexus", "Mercedes"], "Reg_Price": [1000, 1400, 1100, 900, 1700, 1800, 1300, 1150, 1350] } )Let ... Read More

AmitDiwan
280 Views
To display the index of dataframe in the form of multiindex, use the dataframe.index(). At first, let us create a dictionary of lists −# dictionary of lists d = {'Car': ['BMW', 'Lexus', 'Audi', 'Mercedes', 'Jaguar', 'Bentley'], 'Date_of_purchase': ['2020-10-10', '2020-10-12', '2020-10-17', '2020-10-16', '2020-10-19', '2020-10-22'] }Create a DataFrame ... Read More

AmitDiwan
3K+ Views
To replace values of a DataFrame with the value of another DataFrame, use the replace() method n Pandas.At first, let us first create a DataFrame −dataFrame1 = pd.DataFrame({"Car": ["Audi", "Lamborghini"], "Place": ["US", "UK"], "Units": [200, 500]})Let us create another DataFrame −dataFrame2 = pd.DataFrame({"Car": ["BMW", "Lexus"], "Place": ["India", "Australia"], "Units": [800, ... Read More

AmitDiwan
825 Views
We want to replace the negative values with latest preceding positive value. With that, if there’s no positive preceding value, then the value should update to 0.InputFor example, the input is −DataFrame: One two 0 -2 -3 1 4 -7 2 6 5 3 ... Read More

AmitDiwan
870 Views
To drop specific rows rom multiindex dataframe, use the drop() method. At first, let us create a multi-index array −arr = [np.array(['car', 'car', 'car', 'bike', 'bike', 'bike', 'truck', 'truck', 'truck']), np.array(['valueA', 'valueB', 'valueC', 'valueA', 'valueB', 'valueC', 'valueA', 'valueB', 'valueC'])]Next, create multiindex dataframe and set index also −dataFrame = pd.DataFrame( ... Read More

AmitDiwan
1K+ Views
Let us see how to find the sum of negative and positive values. At first, create a dataframe with positive and negative values −dataFrame = pd.DataFrame({'Place': ['Chicago', 'Denver', 'Atlanta', 'Chicago', 'Dallas', 'Denver', 'Dallas', 'Atlanta'], 'Temperature': [-2, 30, -5, 10, 30, -5, 20, -10]})Next, use groupby to group on the basis ... Read More

AmitDiwan
2K+ Views
We will group Pandas DataFrame using the groupby. Select the column to be used using the grouper function. We will group month-wise and calculate sum of Registration Price monthly for our example shown below for Car Sale Records.At first, let’s say the following is our Pandas DataFrame with three columns ... Read More