Python: created 3 for loops to extract data from multiple Excel files, is there a better way to do it?

kinematic_viscosity = ()

kinematic_viscosity_1= ()

kinematic_viscosity_2= ()
#*empty arrays for creating after loop in completed*
for dynamic_viscosity in DV:
   kinematic_viscosities = dynamic_viscosity/Density_PE_298k

for dynamic_viscosity_1 in DV_1:

    kinematic_viscosities_1 = dynamic_viscosity_1/Density_PE_298k
#second loop 
for dynamic_viscosity_2 in DV_2:

    kinematic_viscosities_2 = dynamic_viscosity_2/Density_PE_298k 
#third loop

I understand that this code is running correctly and is taking each Excel file individually, but I want to create a for loop to use this information in multiple Excel files

python: extract the speech of a single character

I want to analyze the language of the individual characters in a play. For example, I have the text of Macbeth and I want to extract every part of the text said by Macbeth. It's possible? How can I do it?
PS: consider that the speech of the characters is usually entered by the full name of the characters in capital letters as in the following example:


LADY MACBETH How are you?

Thank you!

sharepoint server: extract data from one view to another in infopath

Battery exchange network

The Stack Exchange network consists of 175 question and answer communities, including Stack Overflow, the largest and most reliable online community for developers to learn, share their knowledge and develop their careers.

Visit Stack Exchange

product – Magento 1.9 Mysql Query to extract data

I'm a little caught getting magento 1.9 data.
The solution I needed is the mysql query so that I can collect all the data in a table.

The values ​​in the table that I needed from a different table are
Product identification, name, sku, description, price, image name, image path, meta title, meta description.
I don't know much coding, so I definitely need a mysql query.
We expect a solution from experienced developers. Health

Trying to extract the first four roots of a transcendental equation, but I couldn't decide what the first four roots are

I am trying to find the roots of the transcendental equation, for that, I have used the NSolve function, but when I look for roots of b between 0 and 20, it will produce an empty list. If I change the search range from 0 to 10 instead of 0 to 20, I am getting some roots. I am interested in finding the first four roots of the transcendental equation Q. How to achieve this? I have traced my transcendental functions, it seems that there are many roots, now I don't know what my first root is. I am interested in extracting the first four roots.

  P = -4 b^7 (2 K1 Cosh(b L) Sin(b L) Sinh(b z1)^2 + 
         Sinh(b L) (-K1 Cos(b L) + K1 Cos(b (L - 2 z1)) + 4 b^3 Sin(b L) -
             K1 Sin(b L) Sinh(2 b z1)));
    K1 = 1*^12;
    z1 = 1/3;
    L = 1;
    Plot(P, {b, 0, 20})
    NSolve(P == 0 && 0 < b < 20)

How to extract values ​​from another sheet for dynamic data validation

Try this on 'Main Sheet'!B6:

=query(transpose(query('Value Reference'!A1:AJ7,"Select * where A = '"&'Main Sheet'!B4&"'",-1)),"SELECT Col2 where Col1 = '"&'Main Sheet'!B5&"'",0)

2nd solution :

    =QUERY(TRANSPOSE('Value Reference'!B1:AJ7),
    "SELECT Col"&filter(ArrayFormula(IF('Main sheet'!B4='Value Reference'!A2:A7,ROW('Value Reference'!A2:A7),)),
ArrayFormula(IF('Main sheet'!B4='Value Reference'!A2:A7,ROW('Value Reference'!A2:A7),))<>"")
    &" WHERE Col1 = '"&'Main Sheet'!B5&"'")

Using a Query It is a good idea.
First the range: we use Transpose so we can use Col1 for example as a reference instead of A type of selection

The SQL is simple: select the column with the corresponding city (Vancouver), then look for the row with the corresponding range (1001 - 2000)

The hard part is finding the corresponding row in Value Reference of the B5 cell in the Main Sheet.

I used this ugly formula that returns 2,3,4, etc., depending on the value in 'Main sheet'!B4:

ArrayFormula(IF('Main sheet'!B4='Value Reference'!A2:A7,ROW('Value Reference'!A2:A7),)),
ArrayFormula(IF('Main sheet'!B4='Value Reference'!A2:A7,ROW('Value Reference'!A2:A7),))<>"")   

Surely you can find another way to do it, but this is the quick and dirty way.

The second part of the formula is practically the same, trying to select the only row where there is (1001 - 2000) in Col1. (Remember that we transposed the original range).

python: extract a three letter pattern from a given list

To name

I have two problems with your name:

First, do not use underscores to separate words. Instead of uniquepatternuse unique_pattern.

Second, your names don't really tell me anything! Functions, particularly non-method functions, must include a verb unless the verb is implicitly get or is. And implicit is should be used with some caution.

Then instead of unique_pattern, the name must be a phrase that reflects what its function does. As you mention "scaffolding names", maybe that function should be group_scaffold_names_by_unique_pattern?

Or maybe the unique pattern has another name? I like it prefix? (See my question in the comments.) Then maybe it should be group_scaffold_names_by_prefix?

Is that long? Yes. Does it say what's up? Furthermore, if. Clarity for victory!

Redundancy. Repetition. Duplication. Multiple copies

In coding, if you find yourself writing something a second time, STOP! Whatever it is, it must be stored once and referenced from different places. Write a function. Store text in a variable. Create a class Do what is necessary, but DO NOT REPEAT. (This is called the "DRY" principle).

This code is repeated:

    pattern_name ="(A-Z){1}(a-z){2}", name)

What does? Well, it seems to be used to extract the first matching pattern as the "key" for each name in the list.

So, let's write a function for this:

def extract_key(name):
    """ Extract unique pattern from a scaffold name. 
        Apparently, patterns are just the first three characters,
        so don't use regexes, just grab the substring.
    return name(:3)

Use the standard library

It has a separate function that extracts the keys (unique patterns) from the names, and returns a list of them without specifying, which it apparently only uses to initialize the keys of a dictionary.

Instead of doing that, just use collections.defaultdict To create a dictionary that starts with empty lists:

import collections

groups = collections.defaultdict(list)

With that code, you can be sure that groups(key) it is a list (unless you explicitly cancel it with any value that is not from the list). So let's rewrite your function:

import collections
from typing import Dictionary, Iterable, List

def group_scaffold_names_by_prefix(names: Iterable(str)) -> Dictionary(str, List(str)):
    """ Given a list of scaffold names, return a dictionary that
        groups them together by their prefix.
    groups = collections.defaultdict(list)

    for name in names:

    return groups

How to extract letters from a php string

I have a demand to import a spreadsheet and in it I have, among others, the information of a code, what I need to add 01 more to the last code, for example code: ABC123 The following code should be ABC124, ABC125 … Then I thought about doing an extract in the last code and see what the number is and add one more for the following codes. So far so good because I know how to get only the number, but I need to save the letters of this code in another column, that's where my doubt lives. I do not know how to do that.
For example:
$ variable = "ABC123";
// show on echo: ABC

importrange: extract the value of a sheet from the exact row and column entry

OK, this is far from my league.
To simplify things:

B4 has a drop-down list of "data validation" Ex. Vancouver, Surrey, Burnaby, etc.
B5 has a drop-down list of "data validation" Ex. 500, 1000, 2000, etc.

It has ranks called Vancouver, Surrey, Burnaby, etc.
It has columns called 500, 1000, 2000
Cross-reference cells between row and column names have numerical values.

On sheet1
I would like to create a cell (B6) that shows the value of the selection of B4 and B5. Ex. B4 selects Surrey and B5 selects 1000. B6 enters the value of Sheet2 which is Row Surrey and Column 1000