
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
1K+ Views
To delete a column from a DataFrame, use del(). You can also use pop() method to delete. Just drop it using square brackets. Mention the column to be deleted in the brackets and that’s it, for example −del dataFrame[‘ColumnName’]Import the required library with an alias −import pandas as pdCreate a ... Read More

AmitDiwan
184 Views
When it is required to sort strings based on case difference, a method is defined that takes a string as a parameter. This method uses list comprehension and ‘isupper’ and ‘islower’ methods along with list comprehension to get case difference. Their difference gives the sorted values.ExampleBelow is a demonstration of ... Read More

AmitDiwan
222 Views
When it is required to filter similar case strings, list comprehension can be used along with ‘isupper’ and ‘islower’ methods.ExampleBelow is a demonstration of the samemy_list = ["Python", "good", "FOr", "few", "CODERS"] print("The list is :") print(my_list) my_result = [sub for sub in my_list if sub.islower() or sub.isupper()] ... Read More

AmitDiwan
272 Views
When it is required to find the index value that has been repeated in a list, it is iterated over using the list comprehension and ‘enumerate’.ExampleBelow is a demonstration of the samemy_list = [4, 0, 3, 1] print("The list is :") print(my_list) my_result = [element for sub in ... Read More

AmitDiwan
203 Views
When it is required to convert the suffix denomination to values, the dictionary is iterated over and the ‘replace’ method is used to convert them to values.ExampleBelow is a demonstration of the samemy_list = ["5Cr", "7M", "9B", "12L", "20Tr", "30K"] print("The list is :") print(my_list) value_dict = {"M": 1000000, ... Read More

AmitDiwan
233 Views
When it is required to check for similar elements in a matrix row, a method is defined that take a matrix as parameter. The map method is used to covert the matrix to a tuple. The matrix values are iterated over and if the frequency is greater than 1, it ... Read More

AmitDiwan
865 Views
To select rows by integer location, use the iloc() function. Mention the index number of the row you want to select.Create a DataFrame −dataFrame = pd.DataFrame([[10, 15], [20, 25], [30, 35]], index=['x', 'y', 'z'], columns=['a', 'b'])Select rows with integer location using iloc() −dataFrame.iloc[1] ExampleFollowing is the code − import pandas ... Read More

AmitDiwan
4K+ Views
To select rows by passing a label, use the loc() function. Mention the index of which you want to select the row. This is the index label in our example. We have x, y and z as the index label and can be used to select rows with loc().Create a ... Read More

AmitDiwan
188 Views
When it is required to check the alternate peak elements in a list, a function is defined that iterates through the list, the adjacent elements of the array are compared and depending on this, the output is displayed on the console.ExampleBelow is a demonstration of the samedef find_peak(my_array, array_length) : ... Read More

AmitDiwan
504 Views
To cast only a single column, use the astype() method. Let us first create a DataFrame with 2 columns. One of them is a “float64” type and another “int64” −dataFrame = pd.DataFrame( { "Reg_Price": [7000.5057, 1500, 5000, 8000, 9000.75768, 6000], ... Read More