Newest 'count' Questions - Stack Overflow

Questions tagged [count]

Count refers to the number of objects in a collection. It's also a commonly-used SQL function that counts the number of rows.

0
votes
2answers
20 views

How count results from query

How count results from this query using COUNT? SELECT COUNT (*) return wrong result. SELECT files.* FROM files LEFT JOIN tags_files ON tags_files.id_file = files.id LEFT JOIN tags ON tags.id = ...
0
votes
0answers
9 views

how to show custom post count in archive page?

I can show total post count of custom taxonomy in taxonomy archive page. but taxonomy has 2 different custom post types and i want show their count separately according to the type of custom post. i ...
-4
votes
1answer
42 views

Swift: Get the count of an array that includes subscripts [on hold]

I have an array of strings that have superscripts attached to each element. See the example below. var myArray = ["first": ["1", "2", "3"], "second": ["4", "5", "6"], "...
0
votes
0answers
13 views

How to count occurances of values from a single colum within a Pandas dataframe [duplicate]

I have a file which looks like this: kingdom_id phylum_id genus_id species_id 0 <not present> 1224 <not present> 2026735 1 <not present> ...
0
votes
1answer
52 views

Creating a conditional groupby().count of a Pandas DataFrame Where Cells <>0 to create frequency

I have a dataframe that shows the amount of each fee charged to an item. The dataframe is about 10 Million rows. I would like to create a new dataframe that is the count of each item in each column if ...
0
votes
0answers
6 views

Jasper Distinct Group Count

I have a report which has several nested groups - headings, subheadings etc. - and a detail row. For each detail row there are one or more values displayed depending on the group. For instance ...
-2
votes
5answers
63 views

Keep the most recent KeyValuePairs in a SortedList

I have a SortedList that adds KeyValuePairs every 10 min. I'm trying to keep the most recent 10 KeyValuePairs and remove all prior pairs but what I'm doing isn't working. Below I attached my code with ...
0
votes
2answers
38 views

group and count in python

I am trying to get group by and count in python. It does not seem to group for some reason Using python 2.7 #!/usr/bin/env python counts = {} logfile = open("/tmp/test.out", "r") for line in ...
0
votes
0answers
9 views

How to display count of today (24 hours) created nodes of content type?

Im updating drupal from 6 to 8 and need to display count of new nodes created today next to block title. Something like "News (+3)". On old drupal 8 site i got code like. In views PHP format in ...
0
votes
1answer
52 views

Find most active or most recent userid by machineid

I have a table with MachineID, UserID and Date columns. Each day I insert/append into this table a record of which user logs onto which machine, so I end up with a daily historical log of users ...
1
vote
1answer
27 views

Count number of rows in a dataframe having different number of rows for each column

I am doing statistical analysis of some genes in R. The dataframe that contain genes have different number of rows for each column and I want to count the number of rows belonging to each column. I ...
0
votes
0answers
20 views

How to count all the distinct datepart (week) between 2 dates with different years

I need a way to count how many distinct weeks are between 2 dates with different years I have managed to do something like this, the result here is fine,because I use a group by datepart(year) so if ...
1
vote
0answers
47 views

Power BI - How do I get the Status correct based on the columns I add or remove

Am stuck in a situation that I cant seem to solve, still learning so would appreciate if you could tell me what am I doing wrong and how do I get this right? It seems simple, but not for me anymore. ...
0
votes
3answers
29 views

Count minimum values in a vector, where the minumum values are in consecutive order

As the title says, and it's probably very easy, but how can I count the number of minimum values in a vector, or more specific in a subset of vector: Down below is an example: a <- c(1,1,1,2,2) ...
0
votes
2answers
49 views

CountUp.js: not starting to count up

I tried to use countup.js - I used it several times in the past, but now it is not working anymore. Does anybody see the mistake? HTML: <div id="counter">1000</div> JS: function ...
0
votes
1answer
32 views

Count Dates for each variable

Need to sum the number of days a particular variable (animal) occurs Also, need to sum the total hours. In this example, I know macropod occurs on 11 days (all) and pig on (1). Need to replicate ...
0
votes
2answers
58 views

How to count no.of operations performed by str.replace?

I have a dataframe with column comments, I use regex to remove digits. I just want to count how many rows were altered with this pattern. i.e To get a count on how many rows str.replace operated. df['...
1
vote
2answers
42 views

Using group may filter the duplicate records in cakePHP but how to count that grouped records?

Using group in cakePHP filter the duplicate records but I need to know how many records are duplicated? I have tried ->formatResults, ->virtualFields, 'fields' => array('Table.column', 'count(*) ...
0
votes
1answer
12 views

PostgreSQL count other values of ID that have the same value of other column

Let's say we have the following table that stores id of an observation and its address_id. You can create the table with the following code: drop table if exists schema.pl_address_cnt; create table ...
1
vote
1answer
48 views

Recognizing patterns across columns and totaling up scores

I'm hoping to detect specific patterns of 2s across columns, providing a total out of 2, for how many each student (Ids) got correct out of 2 questions. Students were asked to state which of 6 travel ...
0
votes
2answers
22 views

How to fix “FUNCTION doesnt exist” error in mysql? [duplicate]

im writing a query for total sales of each product for each salesman who had sales on more than 1 product on mySQL Tables are : product(Product_id,Product_name,price) , salesman(Salesman_id,...
0
votes
2answers
32 views

Batch file to rename .txt to include number of rows

i have a routine that sends generic .txt files named "orders.txt" every hour. as i receive them, i want to run a batch file to rename the file to: orders_DDMMYYYYMMSS_XXX.txt where XXX would be the ...
0
votes
0answers
22 views

Best choice to do multicount in terms of performance in MongoDB?

I have to do multi counting in MongoDB. I have a collection of docs (around 1.5 million) like this: reportDocument { _id : Guid, status : number (enum value), name : string } with custom index ...
1
vote
2answers
66 views

Can I count multiple columns with Group By?

I have a table with these columns: s, s2, s3 1, 2, 3 4 1, 3 4, 2, 2, 1 3, 4 4 I want to know how many times the unique values in column s appears in the columns s, s2 and s3. So ...
-1
votes
0answers
30 views

Calculating the mean value from elements in a 2D array w/o using any “mean” built in command

I have 126 files in my directory, each contains a 2D array representing the optical depth values for each latitude/longitude point. I want to create an array that has the mean value from all the files ...
2
votes
2answers
98 views

Detecting whether strings arise in a specific order

I'd like to count the number of times my students could state 5 specific words AND subset/filter for the students' responses in which the words were in the correct order. The correct order= green, ...
-1
votes
1answer
19 views

In python / Spyder 3.3.2 I have problens with c = Count() sentence, how can I fix it?

The sentence: >>>c = Counter() prompts me: Traceback (most recent call last): File "", line 1, in c = Counter() NameError: name 'Counter' is not defined Please help. I was tying ...
1
vote
1answer
22 views

Why doesn't CI convert count statement to an array?

I'm trying to make it so that you can view the number of rows of something on my website, I converted the result into an array and then foreached it in the view, yet it calls the argument invalid. As ...
0
votes
0answers
27 views

Counting specific data patterns in a new DF column

My dataframe contains the responses my students provided in an online exam/ test and I'm after some help in analyzing one of the questions. Each participant was put in two weather scenarios (which ...
0
votes
2answers
17 views

R: How to Count Rows with Subsetted Date in Date Formatted Column

I have about 30,000 rows of data with a Date column in date format. I would like to be able to count the number of rows by month/year and year, but when I aggregate with the below code, I get a vector ...
0
votes
0answers
22 views

Count the number of statements per line in C/C++

Given a C program (could be a C++, although for now, i'd stick to C), I want to count the number of statements for every line of code (excluding comments etc of course) I have been writing a parser ...
0
votes
2answers
24 views

How to combine tablenames if equal and count columns SQL

SELECT Tabname, Colname FROM Systemcatalog WHERE Tabschema = 'X' Giving me Tabname, Colname A X1 A Y1 A Z1 B X2 C X3 C Y2 C Z2 ... But ...
1
vote
3answers
69 views

Find the most occuring column in data frame

I want to find the column of a data frame that occurres the most in a certain data frame. For example, the following data frame: as.data.frame(cbind(c(1,4,6,9,20),c(2,4,7,7,3),c(4,7,6,4,2),c(1,4,6,9,...
0
votes
4answers
44 views

How can I count the exact word? [duplicate]

For example I have a code like this string = "abito to doto moto" print(string.count("to")) I just want the result to be 1, but it always count "to" in the other three as well
0
votes
1answer
33 views

Count dynamic items

I have a dynamic data Eg: Name Date Class ______________ John 15/06/2019 AB John 14/06/2019 B John 13/06/2019 C Tom 14/06/2019 C Tom 13/06/2019 D I want the result: Name ClassA ClassB ClassC ...
-1
votes
3answers
77 views

While loop iterating on too many elements in C++ [closed]

When I run the code I get all those numbers as outputs which means that my while loop seems to be going over elements that it should not got over. Why is this happening ? For context I am currently ...
-5
votes
1answer
22 views

Javascript function to count the number of year passed since

I want to find the number of years passed since 2017. i jsut need the years not the month of this current year.
0
votes
1answer
18 views

How do I use a formula to count the number of characters in a text field?

I would like to use an IF() statement if the number of characters in the field is greater than 4. If so, apply another if statement, if not, then null. i have already tried LEN() and FIND(). my ...
0
votes
1answer
20 views

How to select only rows from a table one clumns value is more than b table count value in MySQL

Table A: id, name, school_code ------------------- 1,David,10601 2,Jack,10602 3,John,10603 4,Hank,10602 5,Daisy,10601 6,Kelly,10602 7,May,10602 8,Mayme,10602 Table B: id, school_code,max_stu -------...
0
votes
1answer
31 views

How to count max value in one month from 2 table

I have 2 table on my transaction Table One id | date | cust_id | driver_number 1 2019-01-02 1 F 3350 NN 2 2019-04-02 2 ...
0
votes
0answers
35 views

Counting Smaler Ratio through two different variables

I have 12 different values for an ID in two different dataset, and also start and end Values. What I want to initilize is take the start value as my begining argument of loop and end value as the last ...
1
vote
1answer
34 views

Count function from 2 tables in database

I have 2 tables like these rental_tabel id | date | cust_id | driver_number 1 2019-01-02 1 F 3350 NN 2 2019-04-02 2 ...
2
votes
2answers
91 views

I want to count every occurrence of a value/character in each row of a dataframe in R, INCLUDING when it is surrounded by other values/characters

I have read in an excel sheet as a dataframe that contains various numbers and characters in each row/col (with some NAs). For each row, I want to count how many occurrences of "g" there are, for ...
1
vote
0answers
34 views

Creating a new data frame column that sums multiple correct answers

My dataframe contains the responses my students provided in an online exam/ test and I'm after some help in analyzing one of the questions. It's a little tricky to explain how the question was ...
1
vote
1answer
18 views

Is there a way to count the number of nodes given that a sibling node condition is true?

I am trying to count the number of nodes that exist given a condition in a sibling node is met. I have tried several XPath combinations, but I'm not sure it's possible. <ab:Person> <ab:...
-3
votes
2answers
43 views

how to get the count of a list inside a dictionary

I have a dictionary of lists and I am trying to get a count of the number of items in each list individually. for example dictionary{ list1: item1, item8 list2: item2, item4, item7 list3: item3, ...
0
votes
0answers
16 views

Python pandas how to groupby column and perform count function without remove any duplicate row? [duplicate]

I have following table: id Key series_no 0 B a3 1 B t7 2 A u3 3 A p8 2 A 7u 1 B zz I would like to perform count function at column ...
0
votes
0answers
17 views

How to efficiently count distinct values in a QStandardModel

I'm trying to efficiently count distinct occurrences in a QStandardItemModel and display the results in a QTreeWidget. In a use case where the data model contains 6,000 rows and I am counting the ...
1
vote
1answer
21 views

Hive SQL Distinct Column Syntax Error when calling multiple columns

After using a WITH clause and series of inner joins, I attempted to call back three columns: Employees, SalesID and a COUNT(DISTINCT) and encountered a Syntax Error. This is for a hadoop environment ...
-3
votes
0answers
23 views

How to display dashboard according to different user using codeigniter?

I want to display the dashboard according to User using CodeIgniter. if the User id=1 I just want to see the no of items added by that user ie just a count but I didn't get a solution yet. what do I ...