English 中文(简体)
从使用沙捞越的价值观交汇处检索价值
原标题:Retrieving value from Excel table from an intersection of values using Python

我在Excel有一个桌子,我想读一下(我知道如何做到这一点),但又说,如果存在某种 d、D和B的价值观,那么,为了把顶头一流的价值作为我的方案的一个变数来回来,那么,我就能够读到这个表。 我阅读了有关交叉点的各种职位,我无法确定这些职位是我所期望的,因此我决定问我自己的问题。

我的Excel表格格式如下(仅举一个小例子,因为我可以打上图像):

                      Dimensions
d      D  |  17      27    37     47       17-47
          |                B           |   rsmin
0.6    2     0.8     -     -       -       0.05
1    2.5     1       -     -       -       0.05
1.5    3     1       -     1.8     -       0.05
2      4     1.2     -     2       -       0.05

如果我举一个例子,我有2,D = 4(这两个数值总是在同一行中)和B = 2. 结 论 因此,我要将价值层面=37重新纳入我的方案。 我也有一些问题,即我有几张工作表,因此,我将把这个表作为表1,我必须首先通过所有工作表格阅读,这些表格中各有一个表格。

最佳回答

这里指的是如何根据对你所希望的乐观态度寻找你的桌子。 你们应该能够做5至5层 lo。

def search(table_iterator, d, D, B):
    headings = next(table_iterator)
    junk = next(table_iterator)
    key = [d, D]
    for row in table_iterator:
        if row[0:2] != key: continue
        for index, value in enumerate(row[2:-1]):
            if value == B: 
                return headings(2 + index)
    return None

评论中提问后的最新情况:

““......”应归还我所希望的层面价值?”

是的,它应当做到。 但它采取一种普遍的做法。 我没有回答“gimme teh代码z”问题。 你们必须做一些工作,要么写出适合该工具(假定是Xlrd)的“表_iterator”,由你们阅读该表,要么把它当作你作为指南和完全改写工具。

"""In the end I have compiled all my tables into one .xls document but using several worksheets. Is there a particular way I could go about searching all worksheets and then applying this code?"""

正如我说过的那样,你应该能够做5级以上的 lo。 寻找所有工作表格和then适用本守则似乎是一种奇怪的做法。 你们在找到一个配对器之前,必须er清工作单,相互查询。

问题回答

暂无回答




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签