# Recent questions tagged arrays Problem Hey, I have a problem. I am creating a program by using a dynamic number of threads. I have a vector for that as well. But my program is showing an error during the function calling for passing multiple arguments for the execution of threads. Please help ... nodeNumber; i++)  {             rank_matrix[i] = 0;         }         iter++;         cout << endl;         cout << endl;     }
Problem: Given a list ["foo", "bar", "baz"] and an item in the list "bar", how do I get its index (1) in Python? list.index(x[, start[, end]]) Return zero-based index in the list of the first item whose value is equal to x. Raises a ValueError if there is no such item.
Problem: have a dataframe (df) that looks like: date A 2001-01-02 1.0022 2001-01-03 1.1033 2001-01-04 1.1496 2001-01-05 1.1033 2015-03-30 126.3700 2015-03-31 124.4300 2015-04-01 124.2500 2015-04-02 124.8900 For the entire time-series I'm trying to divide today's value by yesterdays and log the result using the following: df["B"] = math.log(df["A"] / df["A"].shift(1))
Problem: Beginner here! I have got an assignment in which I have to write a program that finds the sum of array elements taken as input from the user. I have to define a function that calculates the sum and returns the sum. The program should print the sum on the ... logic is not so strong so I just failed to build logic. Could anyone from here help me find the solution to this task? Thanks!
Problem: ValueError: Expected 2D array, got 1D array instead: array=[ 45000. 50000. 60000. 80000. 110000. 150000. 200000. 300000. 500000. 1000000.]. Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample."
Problem: A numpy matrix can be reshaped into a vector using reshape function with parameter -1. But I don't know what -1 means here. For example: a = numpy.matrix([[1, 2, 3, 4], [5, 6, 7, 8]]) b = numpy.reshape(a, -1) The result of b is: matrix ... anyone know what -1 means here? And it seems python assign -1 several meanings, such as: array[-1] means the last element. Can you give an explanation?
Problem: Hi there! I am a new learner. I want to know how I can find the position of an element given by the user in an array. I tried some programs but could get the logic. The element, whose position is to be found, will be taken as input from the ... has to choose any element of that array. Can anybody here help me understand the logic of the program? Example program will be a plus. Thanks!
Problem: Here I am just presenting the part of the code that is throwing the error. Here I am merging two different sets of dataframes that are added to two different lists. path1 = '/home/Desktop/computed_2d_blaze/' path2 = '/home/Desktop/computed_1d/' ... .py", line 2944, in _can_reindex raise ValueError("cannot reindex from a duplicate axis") ValueError: cannot reindex from a duplicate axis
Problem: I am a novice Java programmer who started learning to program in Java just a few weeks ago. I got an assignment from my tutor in which I have to write a program that prints the sum of the elements of a given array. The output of the program should be ... } I am allowed to take help from the Internet so asking for help from you guys. Can anybody please provide me with a solution? Thanks!
Problem: I am trying to deploy multi-index with pandas and I keep getting: ValueError: Index contains duplicate entries, cannot reshape Given a dataset with four columns: id (string) date (string) location (string) meaning (float) I first set up a 3- ... Index contains duplicate entries, ' 146 'cannot reshape') 147 ValueError: Index contains duplicate entries, cannot reshape What's going on here?
Problem: Array is a built in abstract data type in C programming. You can conceptualize it as a collection of similar elements. The element number of an array must be initialized when it&rsquo;s declared. What if you wanted to store more elements in arrays after you&rsquo;ve already declared it?
Problem: I have a dynamic DataFrame that works fine, but when there is no data to add to the DataFrame, I get an error. And so I need a solution to create an empty DataFrame with only column names. Until then, I have something like this: df = pd.DataFrame(columns=COLUMN_NAMES) # Note ... "dataframe"> <tbody> <tr> <td>Index([], dtype='object')</td> <td>Empty DataFrame</td> </tr> </tbody> </table>
Problem: How to get most occurring element in an array. It is working well but the only problem is when there are two or more elements having the same number of occurrence? and equal to most occurring element, it just shows the first element scanned. solve this anyone.
Problem: I am getting a warning in my web application pages. the error looks likes &ldquo;call-time pass-by-reference has been removed&rdquo;.
Problem: Given an array which may contain duplicates, print all elements and their frequencies. Examples: Input : arr[] = {10, 20, 20, 10, 10, 20, 5, 20} Output : 10 3 20 4 5 1 Input : arr[] = {10, 20, 20} Output : 10 1 20 2