Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2 issues....Help!
#1
Hi
I have a dataset that contains 3 columns in this form:
col1 = 2007-Q1, 2007-Q2, 2007-Q3....etc
col2 = 1room,2rooms,3rooms...etc
col3 = 24,26,30... etc

1st question:
I need to create this output :
2007-Q1 -> 1 room -> 24
2007-Q2 -> 2 rooms -> 26
2007 -Q3 ->3 rooms ->30

Libraries permitted to use only : numpy and matplotlib

I am stuck at question 1 for a few days. Wall
I have load the dataset using np.loadtxt and tried to create list like this :
import numpy as np 
time = list(data['col'])
type = list(data['col2'])
value = list(data['col3'])

time_type = time + type
for c, value in enumerate(qu_flat, 1):
print(c,value)
Realized the output becomes
1. 2007-Q1
2. 2007 - Q2
3. 2007-Q3
.
.
10. 1 room
11. 2 rooms
13. 3 rooms

How do i go about to have this output:
1. 2007-Q11room ( example: 2007-Q1 join 1 room)
2. 2007-Q22room

2nd question :
I need to check are there any duplicates found between the rows in the same dataset.

Is there a way to say start from row = 1, column 1 or search through the rows?

Thank you very much!
Reply


Messages In This Thread
2 issues....Help! - by veve - Jun-21-2018, 05:28 PM
RE: 2 issues....Help! - by woooee - Jun-21-2018, 05:40 PM
RE: 2 issues....Help! - by veve - Jun-21-2018, 06:24 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020