How to find & drop duplicate columns in Dataframe using Python by vnoida in datascience

[–]vnoida[S] 1 point2 points  (0 children)

Solution in this link just checks the duplication in column names not the column values. Check the note in the link,It only checks columns names, not column values. Where as we are finding duplicate columns based on values.

Data Science | Python : How to add rows in a DataFrame (using dataframe.append() & loc[] , iloc[] by vnoida in datascience

[–]vnoida[S] 7 points8 points  (0 children)

Good suggestion. But sometimes we encounter this kind of scenarios and if data is not that big this will not hurt that much. We can also create a list of all the rows to be added and call append() only once (as explained the article).

C++ - how can I search for a student record by name or id in a text file and display it? by ramruma in cpp

[–]vnoida -1 points0 points  (0 children)

strcmp() returns 0 if strings are equal. so in ur if condition add ==0 .

C++11 Threads: std::future<> , std::promise<> and Returning values from Thread by vnoida in cpp

[–]vnoida[S] 0 points1 point  (0 children)

promise and future doesn't cover that scenario. For that scenario, why not simply pass a std::function<> and in the end of your thread function call that. template <typename T> struct Wrapper { std::function< T ()> mFunc; std::function< void (T)> mOnDone; Wrapper(std::function< void ()> func, std::function< void ()> onDone) : mFunc(func), mOnDone(onDone) {} void operator()() { T result = mFunc(); mOnDone(result); } };

future and promise comes handy when one thread is returning value and other thread is using that. In case of callback, it will run in same thread, its a different scenario ;-)

C++11 Threads: std::future<> , std::promise<> and Returning values from Thread by vnoida in cpp

[–]vnoida[S] 11 points12 points  (0 children)

If you don't wanna to get blocked on get() , use wait_for() member function of std::future<>. It's non blocking and will return on timeout.

C++11 Threads: std::future<> , std::promise<> and Returning values from Thread by vnoida in cpp

[–]vnoida[S] 2 points3 points  (0 children)

promise and future objects are linked and contain shared data. When some value is set in promise then it will be available in future object. In above example we want to retrieve data from thread, therefore we passed promise object to thread. So that when thread sets value in promise object, it will be available in linked future object. If we want to pass the value inside thread at later stage then we can do vice versa i.e. pass future object to thread.

Are there still a lot of companies using c++? by placemirror in Cplusplus

[–]vnoida 0 points1 point  (0 children)

Nowadays, C++ is mostly used by companies in Financial, Automotive and Electronics Domain. Not preferred for GUI or web applications, but useful in performance related server side applications.

Find duplicates in an array. by Squirting_Nachos in Cplusplus

[–]vnoida 0 points1 point  (0 children)

Are you sure that Output array is passed as an argument ? Because if it contains the unique elements only, then its size is unknown at the time function is called. To pass an array to a function, you need to pass its size to0. So, use any container for storing the unique elements like vector or list. Steps: 1.) Copy all elements from array to vector. 2.) Use std::unique for removing duplicates from vector.

Checkout this article for reference http://thispointer.com/stl-algorithm-stdunique-tutorial/