Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104489
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Val Krem <valkrem@yahoo.com> |
| Newsgroups | comp.lang.python |
| Subject | Read and count |
| Date | Wed, 9 Mar 2016 21:30:33 +0000 (UTC) |
| Lines | 39 |
| Message-ID | <mailman.116.1457599150.15725.python-list@python.org> (permalink) |
| References | <2095750566.7009618.1457559033672.JavaMail.yahoo.ref@mail.yahoo.com> |
| Reply-To | Val Krem <valkrem@yahoo.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de 5pS3YbU+ouyUkne9g+QN6gyQb5ko9NNNU/tCqfLkEj3A== |
| Return-Path | <valkrem@yahoo.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.032 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'python)': 0.05; 'learner': 0.09; 'observation': 0.09; 'python': 0.10; '(moving': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'string': 0.17; '2001': 0.18; 'all,': 0.20; 'to:name:python-list@python.org': 0.20; 'trying': 0.22; 'str': 0.29; 'print': 0.30; 'code': 0.30; 'city.': 0.35; 'to:addr:python-list': 0.36; 'thanks': 0.37; 'starting': 0.37; 'data': 0.39; 'to:addr:python.org': 0.40; 'city': 0.65; 'received:98.139.212': 0.66; 'header:Reply-To:1': 0.67; 'received:bullet.mail.bf1.yahoo.com': 0.72; '2002': 0.79; 'message-id:@mail.yahoo.com': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1457559034; bh=ZhGLXGuAXUXqnylUBcB+UVRCuUNSqQhd/SfeBoHApw0=; h=Date:From:Reply-To:To:Subject:References:From:Subject; b=a7G8Q2XAb/MjbK+UjUMqs6dtYVMVWpkdxOW4d9mZXyEW1kqyfzUXaprn9d1r10hyHKRumMhT6WCGtPbmSPqjTk0w5osq3pFsptSGSg4bScH/qImGeKLJahv5uZsKJRjYAWZosl+nl5ymzFaxg9m0xZh6+NT/mOSsMtQFt3Xvi9GuZnMjuWLuba4OhjqZ9DUf8vyDonIkS3Cu7yxqDd4wv9w8vtHxNoYUUpGj1JkG9SMHCYSpms9rilT7i9qiatimvMoPBfdXTdJQ2m+Ptu80Rh+jlYmU2Y9xudv0xTqan1uqKWSA8pTa1vI7DRgmlF9CWRkBdCHBide0sLRnoNH58A== |
| X-Yahoo-Newman-Property | ymail-3 |
| X-Yahoo-Newman-Id | 345562.34686.bm@omp1033.mail.bf1.yahoo.com |
| X-YMail-OSG | wzoIhb8VM1kPKUGC6JnYad3j1_f3AfjzYuM3fmaDMxYrjxJyUHhlJnrYWeRKyTz xmq7PJpdVcGRB3AYUfNEv9MLrrxNaDybF1a7lxQ6KohAxRUVoFtd7i_GbYjzJUhgKqp3StgzbEbI iJQ4YYbT04qOrMp2aP16tOue9AU9eo04leTjRBXt8DYWLnLhvBnQckkGHWeSKv0WoXQh9EdXRWHa 5KZSOB6935GPjYRELjBXCNgb47OJUphM5aHzpt5QlqWJK.yD6j1rqvInBBJ4Wvbk3fEHJqDx.u_f cid9zZdyNdRUSjo24d0QhhAW_0_HbXrFF3fYDWXvFMDCRT.V8jNtz9aP_U5nyXGUwvTKNsm0tvSP 7XuaSfituH..DK3HhhL3taHcO7tLGQj_N_DIsvMgwXzStO1lTNegjOdCvehAyruMpxe4fFyzUYAF HYJzV6.zCvyPZvGOkrTQ12M92BnYfJaXgGMsZpByMwi7caErfJmmyhAE56brc_EN2bf8uCAARt3J wE7oD |
| X-Mailman-Approved-At | Thu, 10 Mar 2016 03:39:09 -0500 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:104489 |
Show key headers only | View raw
Hi all,
I am a new learner about python (moving from R to python) and trying read and count the number of observation by year for each city.
The data set look like
city year x
XC1 2001 10
XC1 2001 20
XC1 2002 20
XC1 2002 10
XC1 2002 10
Yv2 2001 10
Yv2 2002 20
Yv2 2002 20
Yv2 2002 10
Yv2 2002 10
out put will be
city
xc1 2001 2
xc1 2002 3
yv1 2001 1
yv2 2002 3
Below is my starting code
count=0
fo=open("dat", "r+")
str = fo.read();
print "Read String is : ", str
fo.close()
Many thanks
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Read and count Val Krem <valkrem@yahoo.com> - 2016-03-09 21:30 +0000
Re: Read and count Jussi Piitulainen <jussi.piitulainen@helsinki.fi> - 2016-03-10 11:11 +0200
Re: Read and count Peter Otten <__peter__@web.de> - 2016-03-10 10:33 +0100
Re: Read and count Val Krem <valkrem@yahoo.com> - 2016-03-10 11:09 -0600
csiph-web