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
1answer
11 views

alias for count in Pyspark

I am new to Pyspark. I am trying to use alias for count function. For some reason if I use agg in front of count then alias is working but if I am not aggregating then the alias is giving me error. .(...
0
votes
1answer
18 views

How to count number of occurence in a large dataset

I'm trying to count the number of occurence of each "scenarios" that I have (0 to 9) in a data frame over 25 years. Basically, I have 10000 simulations of scenarios named 0 to 9, each scenario having ...
1
vote
1answer
31 views

wc -l and python line count differ

I'm wondering why a simple line count using bash is giving me a different number of lines than that computed using python (version 3.6) for the files given here (train_en.txt) and here (train_de.txt). ...
1
vote
1answer
14 views

MySQL Grouping using group_concat and then Group BY

I have a table like this: Basically, I want to group all names and give the count of such groupings like: Since there are 2 users with cooking and cleaning, 1 for washing and 4 for cooking. I am ...
0
votes
2answers
39 views

count(): Parameter must be an array or an object that im plements Countable error based on the array size

This error is generated in the code below only when the returned array is too long. With short arrays (I do not know exactly how much) does not occur. $phone_numbers = array(); if(!empty($_POST['...
2
votes
2answers
21 views

I want to compare the row count of two different Excel files in SSIS get an email alert

I am looking for a way to compare the row count of two Excel files in SSIS, and if the row count of one of the files is >= the row count of the second, I would like to receive an email informing me of ...
1
vote
2answers
36 views

Count Variable by Subgroup and Over Time

I am working with panel data. Specifically, I am dealing with data that is structured for duration analysis. I am looking at when a U.S. state adopts a policy. I have around 500 different policies, ...
1
vote
0answers
53 views

How to count string occurrences in another string in base R? [duplicate]

I simply want to count the occurrences of a string, e.g. 'xy', in another string, e.g. 'kxyloixyea', without using any extra libraries. There are many questions and answers for columns and data ...
0
votes
0answers
12 views

Inconsistent count results from Apache HIVE

We have the latest Hortonworks's HDP, with Hive version (3.1.0) I have a problem when trying to count the number of rows, on a given condition. The count (*) returns false value when executed side by ...
0
votes
1answer
15 views

Multi-column dependent countifs in Google Sheets

Let's say I have 3 columns. I am trying to find the count of Zeros in the 3rd column IF column A is X AND column B is Y. Is this possible? I've seen other people ask similar questions, but not seeing ...
0
votes
3answers
24 views

Count number of occurrences in category grouped by date

I have a list of data (~7000) lines that are marked by their week commencing dates. Each row of data has a certain category associated with it, I want to make a query or results table that takes each ...
0
votes
1answer
15 views

How to count duplicate log entries

I want to analyse a log file and count recurring log entries. I saw this answer, but every log entry is unique because of the time stamp. If the log entry is of the format Time stamp: [log message] ...
-1
votes
2answers
32 views

Count multiple columns with Group By and Union All?

I have a query where I want to count the values of 3 columns s, s2 and s3 and use Group By the values of column s? So far i have made this db-fiddle This will give me the output 1 - count 3 2 - ...
0
votes
2answers
29 views

Grouping shortened string and unshortened string from a case expression into a count

Sorry if I don't explain this very well or haven't given enough info. I am trying to combine figures using count but I am running into a problem where the data from my case expression isn't grouping ...
-3
votes
1answer
33 views

How Can I count the number of occurences for two items in a nested list

I have a nested list a = [[1,'a','b'], [2,'c','d'], [3,'a','b']] how can i count the number of occurrences that a & b appeared in the nested list? in this case the answer shall be 2 times. p....
0
votes
2answers
30 views

How count results from query

How to count results from this query using COUNT keyword? SELECT COUNT (*) returns wrong result. SELECT files.* FROM files LEFT JOIN tags_files ON tags_files.id_file = files.id LEFT JOIN tags ON ...
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
45 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
60 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
11 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
72 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
11 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
22 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
51 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
59 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
44 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
50 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
23 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
24 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
69 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
100 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
20 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 ...
2
votes
1answer
26 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
18 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
45 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 ...