• Register

Recent questions tagged arrays

0 votes
1 answer 5 views
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] = 0;         }         iter++;         cout << endl;         cout << endl;     }
asked 3 days ago chris jordan 2.2k points
0 votes
1 answer 15 views
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.
asked Jan 10 Mashhoodch 5.6k points
0 votes
1 answer 15 views
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))
asked Jan 10 Mashhoodch 5.6k points
0 votes
1 answer 10 views
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!
asked Jan 8 Code Learner 5.5k points
0 votes
1 answer 18 views
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."
asked Jan 8 Mashhoodch 5.6k points
0 votes
1 answer 2 views
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?
asked Jan 7 Mashhoodch 5.6k points
0 votes
1 answer 12 views
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!
asked Jan 2 Code Learner 5.5k points
0 votes
1 answer 39 views
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
asked Jan 1 sasha 5.3k points
0 votes
1 answer 16 views
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!
asked Dec 29, 2020 Code Learner 5.5k points
0 votes
1 answer 19 views
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?
asked Dec 25, 2020 sasha 5.3k points
0 votes
1 answer 4 views
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?
asked Dec 23, 2020 Mashhoodch 5.6k points
0 votes
1 answer 10 views
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>
asked Dec 23, 2020 sasha 5.3k points
0 votes
1 answer 7 views
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.
asked Dec 23, 2020 Mashhoodch 5.6k points
0 votes
1 answer 19 views
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;.
asked Dec 18, 2020 prog_learner 2.5k points
0 votes
1 answer 5 views
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
asked Dec 13, 2020 Mashhoodch 5.6k points
0 votes
1 answer 12 views
Problem: I am new to php and want to learn how the function array_key_exists in php is used?
asked Dec 12, 2020 prog_learner 2.5k points
0 votes
1 answer 27 views
Problem: What is array_diff_assoc in php? How can we use this function?
asked Dec 11, 2020 prog_learner 2.5k points
0 votes
1 answer 16 views
Problem: What is the Array_count_values function in php.
asked Dec 10, 2020 prog_learner 2.5k points
0 votes
1 answer 8 views
Problem: The easiest way to create an array of structures is to use the REPLICATE function. The first parameter to REPLICATE is a reference to the structure of each element. Using the example in and assuming the STAR structure has been defined, an array containing 100 elements of the structure is created with the following statement: cat = REPLICATE({star}, 100)
asked Dec 5, 2020 Mashhoodch 5.6k points
0 votes
1 answer 47 views
Problem: Hi there! I am new here in this magical world of programming and currently I am learning and trying to grasp things in Java. My question is about arrays in Java. I know how to declare and initialize arrays but I want to know that is this necessary to specify ... of array each time I declare an array? Moreover, is specifying the size of array mandatory? What if I skip any of these two?
asked Nov 30, 2020 Code Learner 5.5k points