Thank you very much for the help.
First I want count by city and year.
City year count
Xc1.2001. 1
Xc1.2002. 3
Yv1. 2001. 1
Yv2.2002. 4
This worked fine !
Now I want to count by city only
City. Count
Xc1. 4
Yv2. 5
Then combine these two objects with the original data and
Try to do a .split(' ') and then add field 0 and 1 to an list.
For open the file you can do it easier:
with open(file) as f:
for line in f:
print('line')
-Original Message-
From: Python-list
[mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf Of
Val Krem via Pyt
Jussi Piitulainen wrote:
> Val Krem writes:
>
>> 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
Hello and welcome.
Please see my comments below.
On 09/03/2016 21:30, Val Krem via Python-list wrote:
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
Val Krem writes:
> 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
>