Frequency distribution of items of each list in latex - list

I have a .tex file with many "enumerate" lists.
Can I produce a table where I have the name of each list and the number of items within each list?
For example I would like the outcome to be something like this
List 3 25
List 1 10
List 2 8
List 4 5
and so on.
This means that list 3 has most items (25), list 1 has 10 items, and so on.
Is this possible in latex?

Related

Python Data frame Find and replace column values from a list

I have a data frame with 4 columns. i will typically have 200 or more so rows. i have an example below showing 4 rows as an example. There is a column for account number. this account number may appear multiple times in the column. i have a separate excel sheet with 2 columns, listing account number and account name. I want to replace the account number with the corresponding account name shown on my excel sheet. I cannot manually type out using the replace function for every account number, as there are hundreds of account names and numbers. is there a way i can replace the account number with their relevant account names? or perhaps append a new column showing the relevant account name?
If I understand correctly, you want something like the following (You can get l1 and l2 by parsing the excel sheet):
import pandas as pd
l1 = [100, 200]
l2 = [1000, 2000]
z = pd.DataFrame({"one": [100,100,300,200], "two": [100,100,300,200]})
"""
one two
0 100 100
1 100 100
2 300 300
3 200 200
"""
print(z)
z.two.replace(l1, l2, inplace=True)
"""
one two
0 100 1000
1 100 1000
2 300 300
3 200 2000
"""
print(z)

Merging Tables Correctly in SAS

Hi I am trying to merge two tables the FormA scores table that I made that is now CalculatingScores with the domain number found in DomainsFormA. I need to merge them by QuestionNum. Here is my code.
proc sql;
create table combined as
select *
from CalculatingScores inner join DomainsFormA
on CalculatingScores.Scores=DomainsFormA.QuestionNum;
quit;
proc print data=combined (obs=15);
run;
This table is what I am trying to get my merged tables to look like but for 15 observations.
Form
Student
QuestionNum
Scores
DomainNum
A
1
1
0
5
A
1
2
1
4
A
1
3
0
5
But My tables look more like this
Form
Student
QuestionNum
Scores
DomainNum
A
1
2
1
5
A
1
4
1
5
A
1
5
1
5
My entire Scores column for these 15 observations have a value of 1. Also my DomainNum column only has values of 5. My Student and Form columns are correct but I need to have varied scores and varied domain numbers. Any ideas for how to solve my problem? Maybe I need a order by statement?
You appear to be joining on the incorrect columns
You coded
on CalculatingScores.Scores=DomainsFormA.QuestionNum
which is joining a score to a question number
perhaps you should be coding
on CalculatingScores.QuestionNum=DomainsFormA.QuestionNum
^^^^^^^^^^^ ^^^^^^^^^^^

PowerBI and SharePoint lists: How do I count the number of rows with the PID value equal to each row's UID (the 3rd column needs the formula)

I have a table below, and I need to calculate the last column as a custom measure/custom column. I'm grateful for any advice concerning the formulae. Please note this is a single table. The last column counts the number of rows which have as PID, the respective row's UID.
Please note, I am using SharePoint lists so addressing the ID column will be done via: 'SharePoint list name'[Id] which is the standard syntax when calling a SharePoint list column.
ID PID Count rows
1 2
2 1 1
3 1 0
4 0
5 2 0
Many thanks for considering my request.
I am using Power BI Desktop 2.83.
I found the answer:
Create a second identical SharePoint list and use the below.
Additional column =
    calculate (
        COUNTROWS('SharePoint list (replica)'),
        FILTER('SharePoint list (replica)','SharePoint list (replica)'[PID]='SharePoint list'[ID])
    )

Increment ID# by 1 if Same month ArrayFormula

I'm trying to set up an array formula in a google sheet to save filling in a simple formula for ID#s.
The sheet is populated by a google form, so it receives a timestamp. Let's say these are orders.
If the month of the order matches that of the previous I want to increase the ID# by one, essentially counting this months orders. The complete ID# is actually made up of several factors, the order count being just one of them (so that they are unique), but for the sake of this exercise, I'll keep it simple.
If the month of the order does not match the previous, then safe to say we've entered the new month and the ID should restart at 01.
I have a column that has the extracted month from the timestamp. So the data looks like this:
A B
ID# MONTH
1 1
2 1
3 1
4 1
5 1
6 1
1 2
2 2
3 2
1 3
2 3
3 3
4 3
I can't get the arrayformula to work! I've tried numerous countIfs and Ifs, something like
=ARRAYFORMULA(if(len(B2:B),if(B3:B<>B2:B,1,A2:A+1),""))
Does anyone have any suggestions for this?
I found it hard to Google for and have tried a few search terms!
try:
=ARRAYFORMULA(IF(B1:B<>"", COUNTIFS(B1:B, B1:B, ROW(B1:B), "<="&ROW(B1:B)), ))

Stata: list only few number of records with condition

I would like to list only few numbers of records with some conditions. Problem: if I use in 1/4 or _n <= 4 and the first 4 records do not satisfy the condition no records are listed. Here is an example:
clear
input x
1
2
3
4
5
6
end
list if x > 4 & _n <= 3
list in 1/3 if x > 4
Does anybody has an idea how can be solved this problem in one line?
Thanks for help.
Put the following code into a file named slist.ado in directory where Stata can see it (like ~/ado/personal). You can find such directories with the -adopath- command.
program define slist
version 12.1
syntax [varlist] [if], top(int)
#delimit;
tempvar tag;
gen `tag'=1 `if';
sort `tag';
list `varlist' `if' in 1/`top';
end;
The syntax is slist x if x>4, top(4). The if you don't specify x, it will give you all the variables in your dataset.