Remove rows that are not multiple of 7 in OpenOffice Calc - openoffice-calc

In OpenOffice Calc I have a list of 9000 rows with many values.
I want to remove all the rows that are not multiple of 7.
Example:
Row 1
Row 2
Row 3
Row 4
Row 5
Row 6
Row 7
Row 8
Row 9
Row 10
Row 11
Row 12
Row 13
Row 14
Row 15
Becomes:
Row 7
Row 14
How would you do that?

Fill a spare column (eg B) with:
=MOD(ROW();7)
Filter the sheet on that column:
Select all and Delete Cells... (entire row) then remove filter (and delete ColumnB, if you wish).

Related

How to apply conditional formatting to rows?

I have some requirements, I need to format rows by their efficiency. BI is now formatting by columns and has no default settings for rows. This is what it looks like now:
but i need to do like this:
I not good at DAX yet, so i don't understand how to do this. I mean how to formate values for row, for example:
1 1 0 4 5 6 10
2 0 3 0 5 2 4
3 1 3 1 4 2 1
Where "0" is min of the 1st row and "10" is max of the 1st row; In row 2 min is a "0" and "5" is a max and so on.
Can you help me? Any advice or links would be appreciated. Thank you!
I tried creating additional tables for sorting. Some manipulation of measures. But no one method sorts by rows.

Remove single column value from row total value a a PowerBi Matrix

I have a matrix that has numerous categories/columns with a total of each row. I want a specific column to remain in the matrix, but should not form part of the row total.
Dog
Cat
Chicken
Total (Excl. Chicken)
2
2
10
4
2
4
100
6
I only find ways to either remove the row total of the column totals for specific columns. Also appear that measures does not work in matrix's. Do I need to rather use a table with a added measure or is there a way with a matrix?

PowerBI - calculated field to check for dissimilar items in a semi-colon separated list in a row cell

I am using PowerBI desktop to create visualization from data source (a table in excel sheet) and I need to create a calculated field from one of the columns from the data. One of the columns in my data table is as follows:
Technology
A
A;A
B;B;B
C;D;C
A;A;B
B;B;B
D;D
A;
;
;;
I want to create a new column of type Boolean that outputs 1 when only one unique item is in a row of column and 0 when items in the semi-colon separated list are not unique. Like this:
Technology
New Column
A
1
A;A
1
B;B;B
1
C;D;C
0
A;A;B
0
B;D;B
0
D;D
1
A;
1
;
0
;;
0
How can I do this in PowerBI desktop?
EDIT: Updated requirements to test three more cases. (last three rows)
Add a new column and type in the following:
if List.Count( List.RemoveItems( List.Distinct( Text.Split([Technology],";")), {""})) = 1 then 1 else 0

Print Specific Rows and Columns in Pandas

I am having trouble printing certain values within my CSV.
I have a file that has 9 columns
Record_id Month Day Year Location_id Animal_id Sex Length Weight
and over 1000 rows.
I want to print Month , Day , and Year columns when the year is equivalent to 2002.
Because I have a lot of data I decided to only work with the first 5 rows where year is equal to 2002.
This is my code:
data.df.iloc[0:5, 1:4]
With this I can print the first 5 rows and the 3 columns I desire. However I can't figure out how to filter the year to be 2002
you can start by getting all the rows where year equal to 2002
with
filtered_data = df[df["Year"]==2002]
then you can apply your code to get only the first five rows and the three selected columns with
filtered_data.iloc[0:5, 1:4]

pandas keep rows based on column values for repeated values

I have a pandas data frame and I have a list of values. I want to keep all the rows from my original DF that have a certain column value belonging to my list of values. However my list that I want to choose my rows from have repeated values. Each time I encounter the same values again I want to add the rows with that column values again to my new data frame.
lets say my frames name is: with_prot_choice_df and my list is: with_prot_choices
if I issue the following command:
with_prot_choice_df = with_df[with_df[0].isin(with_prot_choices)]
then this will only keep the rows once (as if for only unique values in the list).
I don't want to do this with for loops since I will repeat the process many times and it will be extremely time consuming.
Any advice will be appreciated. Thanks.
I'm adding an example here:
let's say my data frame is:
col1 col2
a 1
a 6
b 2
c 3
d 4
and my list is:
lst = [a,b,a,a]
I want my new data frame, new_df to be:
new_df
col1 col2
a 1
a 6
b 2
a 1
a 6
a 1
a 6
Seems like you need reindex
df.set_index('col1').reindex(lst).reset_index()
Out[224]:
col1 col2
0 a 1
1 b 2
2 a 1
3 a 1
Updated
df.merge(pd.DataFrame({'col1':lst}).reset_index()).sort_values('index').drop('index',1)
Out[236]:
col1 col2
0 a 1
3 a 6
6 b 2
1 a 1
4 a 6
2 a 1
5 a 6