Tag: Values
C++11 Multithreading – Part 8: std::future , std::promise and Returning values from Thread
A std::future object can be used with asych, std::packaged_task and std::promise. In this article will mainly focus on using std::future with std::promise object. Many times we encounter a situation where we want a thread to return a result. Advertisements Now question is how to do this? Lets take an example, Frequently Asked: C++11 Multithreading – …
C++11 Multithreading – Part 8: std::future , std::promise and Returning values from ThreadRead More
Finding all values for a key in multimap using equals_range – Example
Multimap store elements in key value pair. It can also have duplicate keys. There can be many scenarios when we want to find all the values associated with a key in multimap. For example, we have a multimap of char & int as key value pair and initialzed with following values i.e. Advertisements {‘a’, 1}, {‘b’, …
Finding all values for a key in multimap using equals_range – ExampleRead More
Java : Creating HashMap by associating multiple values with same Key
In this article we will discuss how to create a HashMap with multiple values associated with same Key in Java. Suppose we want to create a HashMap to keep the track of strings and their occurrences in text. For example. Advertisements “the” occurred at following indexes 1,4,8,12. “at” occurred at following indexes 22, 28, 44 …
Java : Creating HashMap by associating multiple values with same KeyRead More
How to copy all Values from a Map to a Vector in C++
In this article we will discuss how to fetch all values from a map and put them in vector. Suppose we have a map of words and their frequency count i.e. Advertisements // Map of string & int // To store the frequency count of words std::map<std::string, int> wordMap = { { “is”, 6 }, …
How to copy all Values from a Map to a Vector in C++Read More
Python : How to create a list and initialize with same values
In this article we will discuss how to create a list and initialise with same values. Creating a list of same values by [] and multiply Suppose we want to create a list of strings, which contains 20 same strings i.e. ‘Hi’ Advertisements [‘Hi’, ‘Hi’, ‘Hi’, ‘Hi’, ‘Hi’, ‘Hi’, ‘Hi’, ‘Hi’, ‘Hi’, ‘Hi’, ‘Hi’, ‘Hi’, …
Python : How to create a list and initialize with same valuesRead More
Python : How to create a list of all the Values in a dictionary ?
In this article we will discuss how to create a list of all the values in dictionary. Suppose we have a dictionary of string and integers i.e. Advertisements # Dictionary of string and int wordFreqDic = { “Hello”: 56, “at” : 23 , “test” : 43, “this” : 2, “here” : 23, “city” : 2, …
Python : How to create a list of all the Values in a dictionary ?Read 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
Python Pandas : Count NaN or missing values in DataFrame ( also row & column wise)
In this article we will discuss how to find NaN or missing values in a Dataframe. Manytimes we create a DataFrame from an exsisting dataset and it might contain some missing values in any column or row. For every missing value Pandas add NaN at it’s place. Advertisements Let’s create a dataframe with missing values i.e. …
Python Pandas : Count NaN or missing values in DataFrame ( also row & column wise)Read More
Python : Find unique values in a numpy array with frequency & indices | numpy.unique()
In this article we will discuss how to find unique values / rows / columns in a 1D & 2D Numpy array. Also how to find their index position & frequency count using numpy.unique(). numpy.unique() Python’s numpy module provides a function to find the unique elements in a numpy array i.e. Advertisements numpy.unique(ar, return_index=False, return_inverse=False, return_counts=False, …
Python : Find unique values in a numpy array with frequency & indices | numpy.unique()Read 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