Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #5709
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Peter Otten <__peter__@web.de> |
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] Verstaendnisproblem |
| Date | Thu, 11 Feb 2021 18:48:23 +0100 |
| Lines | 69 |
| Message-ID | <mailman.1094.1613066430.7193.python-de@python.org> (permalink) |
| References | <2763401.e9J7NaK4W3@host.fritz.box> <1a1fb6e2-6050-27c4-60c2-7715153217c2@sschwarzer.net> <107543700.nniJfEyVGO@host.fritz.box> <bff5cf57-b57b-300b-17d8-5390cd8bb3da@web.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.uni-berlin.de qR/2OdZc5NlX8oGEMlFYVQJpAnPKzrlaPfDEwZd0MqAQ== |
| Return-Path | <gcpgg-python-de@m.gmane-mx.org> |
| X-Original-To | python-de@python.org |
| Delivered-To | python-de@mail.python.org |
| Authentication-Results | mail.python.org; dkim=none reason="no signature"; dkim-adsp=none (unprotected policy); dkim-atps=neutral |
| X-Injected-Via-Gmane | http://gmane.org/ |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 |
| In-Reply-To | <107543700.nniJfEyVGO@host.fritz.box> |
| Content-Language | en-US |
| X-BeenThere | python-de@python.org |
| X-Mailman-Version | 2.1.34 |
| Precedence | list |
| List-Id | Die Deutsche Python Mailingliste <python-de.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-de>, <mailto:python-de-request@python.org?subject=unsubscribe> |
| List-Archive | <https://mail.python.org/pipermail/python-de/> |
| List-Post | <mailto:python-de@python.org> |
| List-Help | <mailto:python-de-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-de>, <mailto:python-de-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <bff5cf57-b57b-300b-17d8-5390cd8bb3da@web.de> |
| X-Mailman-Original-References | <2763401.e9J7NaK4W3@host.fritz.box> <1a1fb6e2-6050-27c4-60c2-7715153217c2@sschwarzer.net> <107543700.nniJfEyVGO@host.fritz.box> |
| Xref | csiph.com de.comp.lang.python:5709 |
Show key headers only | View raw
On 11/02/2021 18:29, eilfh wrote: > Am Donnerstag, 11. Februar 2021, 13:19:56 CET schrieb Stefan Schwarzer: > Hallo, Stefan > > vielen Dank für Deine schnelle Antwort > > > > Vorhanden sind (neben Anfängerwissen über python, pandas & co.) > > eine (Excel-)Tabelle mit Zählerständen zu konkreten Terminen, > die ich in ein pandas-Dataframe eingelesen habe. > > Mit df...shift(1) kann ich die Differenzen zwischen Zählerablesungen bestimmen. > > > > Gelegentlich wird auch ein Zähler ausgetauscht. > > x1 sei die letzte Ablesung vor dem Tausch > x2, x3 seien Ausbau- bzw. Einbauzählerstand > x4 erste Ablesung nach dem Tausch > (x5 sei die (Zeit-)Differenz zischen den beiden routinemäßigen Ablesungen.) > > > Der neu zu berechnende Verbrauch wäre dann > > v = (x2 - x1 + x4 - x3) / x5 > > > >> bekomme ich keinen Skalar, sondern ein `pandas.Series`- Objekt. > > Du hast recht, das war ein entscheidender Hinweis! > > statt: > x1 = df.loc[df.Datum == '1993-09-09', 'Spalte_7'] > ---> 55 490 > > besser: > x1 = df.at[55, 'Spalte_7'] > ---> 490 (der gesuchte Skalar) > > > aber woher/womit erfahre ich die "rowid" 55 ? Brauchst Du denn die Zeile? Eine Series mit genau einem Wert >>> x 0 4 Name: B, dtype: int64 >>> type(x) <class 'pandas.core.series.Series'> kannst Du einfach entpacken >>> [y] = x >>> y 4 >>> type(y) <class 'int'> oder wenn du weißt, dass Du z. B. eine Fließkommazahl erwartest, direkt konvertieren: >>> float(x) 4.0
Back to de.comp.lang.python | Previous | Next | Find similar
Re: [Python-de] Verstaendnisproblem Peter Otten <__peter__@web.de> - 2021-02-11 18:48 +0100
csiph-web