We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Tag: on

Remove all occurences of an element from vector in O(n) complexity

Suppose we have a vector of integers and we want to delete all occurences of a number from it i.e. Let’s say vector contain following numbers 1,2,5,4,5,1,5,7,8,9. Now we want to delete all the occurences of 5 from it, so that vector contents should become – 1 2 4 1 7 8 9 . Also …

Remove all occurences of an element from vector in O(n) complexityRead More

How to remove elements from a List based on value or External Criterion

In this article we will discuss how to remove an element from a List by matching a value or by matching some criterion. std::list provides two member functions for removing elements based on value i.e. std::list::remove and std::list::remove_if. Advertisements Using std::list::remove to remove element by value void remove (const value_type& val); It removes all the elements …

How to remove elements from a List based on value or External CriterionRead More

Pandas – Select Rows by conditions on multiple columns

In this article we will discuss different ways to select rows in DataFrame based on condition on single or multiple columns. Following Items will be discussed, Advertisements Select Rows based on value in column Select Rows based on any of the multiple values in column Select Rows based on any of the multiple conditions on …

Pandas – Select Rows by conditions on multiple columnsRead More

Python Pandas : How to Drop rows in DataFrame by conditions on column values

In this article we will discuss how to delete rows based in DataFrame by checking multiple conditions on column values. DataFrame provides a member function drop() i.e. Advertisements DataFrame.drop(labels=None, axis=0, index=None, columns=None, level=None, inplace=False, errors=’raise’) It accepts a single or list of label names and deletes the corresponding rows or columns (based on value of axis …

Python Pandas : How to Drop rows in DataFrame by conditions on column valuesRead More

Pandas : Find duplicate rows based on all or few columns

In this article we will discuss ways to find and select duplicate rows in a Dataframe based on all or given column names only. DataFrame.duplicated() In Python’s Pandas library, Dataframe class provides a member function to find duplicate rows based on all columns or some specific columns i.e. Advertisements DataFrame.duplicated(subset=None, keep=’first’) It returns a Boolean …

Pandas : Find duplicate rows based on all or few columnsRead More

Pandas: Sort rows or columns in Dataframe based on values using Dataframe.sort_values()

In this article we will discuss how to sort rows in ascending and descending order based on values in a single or multiple columns . Also, how to sort columns based on values in rows using DataFrame.sort_values() DataFrame.sort_values() In Python’s Pandas library, Dataframe class provides a member function to sort the content of dataframe i.e. Advertisements …

Pandas: Sort rows or columns in Dataframe based on values using Dataframe.sort_values()Read More

Pandas : Merge Dataframes on specific columns or on index in Python – Part 2

In this article we will discuss how to merge dataframes on given columns or index as Join keys. First let’s get a little intro about Dataframe.merge() again, Advertisements Dataframe.merge() In Python’s Pandas Library Dataframe class provides a function to merge Dataframes i.e. DataFrame.merge(right, how=’inner’, on=None, left_on=None, right_on=None, left_index=False, right_index=False, sort=False, suffixes=(‘_x’, ‘_y’), copy=True, indicator=False, validate=None) …

Pandas : Merge Dataframes on specific columns or on index in Python – Part 2Read More

Pandas : Sort a DataFrame based on column names or row index labels using Dataframe.sort_index()

In this article we will discuss how to sort the contents of dataframe based on column names or row index labels using Dataframe.sort_index(). Dataframe.sort_index() In Python’s Pandas Library, Dataframe class provides a member function sort_index() to sort a DataFrame based on label names along the axis i.e. Advertisements DataFrame.sort_index(axis=0, level=None, ascending=True, inplace=False, kind=’quicksort’, na_position=’last’, sort_remaining=True, …

Pandas : Sort a DataFrame based on column names or row index labels using Dataframe.sort_index()Read More

Python : Filter a dictionary by conditions on keys or values

In this article we will discuss different ways to filter contents from a dictionary by conditions on keys or value or on both. Suppose we have a dictionary in which int type element is key and string type elements are value i.e. Advertisements dictOfNames = { 7 : ‘sam’, 8: ‘john’, 9: ‘mathew’, 10: ‘riti’, …

Python : Filter a dictionary by conditions on keys or valuesRead More

Cart

Your Cart is Empty

Back To Shop