Bottom Page

Thread Rating:
  • 2 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Importing file in dataframe and populating missing column name
#1
Hi All,

I am trying to import a survey data on hotel industry . First 2 columns have name and rest of the column doesn't have .I need to populate year_monthNo from column 3.

source AS is

H01: D875
H02: Tourism -unit availabe in thousand
125
126.3
126.7
128
129.1
H01: D875
H02: Tourism -unit sold in thousand
78
80.2
74.3
75.3

Want to convert data into dataframe like this. How can i achieve this.

 ID              Survey Desc                                             Jan-16   Feb-16   Mar-16   Apr-16
H01: D875 H02: Tourism -unit availabe in thousand   125       126.3     126.7     128
H01: D875 H02: Tourism -unit sold in thousand         78         80.2       74.3        75.3 

Thanks
Quote
#2
Please post code that you have tried (between the code brackets) as well as any error codes (between the error brackets).

Do you enter the information manually or is it in a database, saved to some type of file (for example, 'csv', excel, or text)?  Are you looking to read and write to the database, or simply read it and format it in the manner that you show in what you expect?
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  txt-file: read and append missing data sufi 0 36 3 hours ago
Last Post: sufi
  Importing a .py file with a value of a variable Sk4rd 2 215 Nov-09-2019, 08:29 AM
Last Post: buran
  Problem with importing a CSV file Chopan2211 6 289 Nov-06-2019, 09:25 AM
Last Post: DeaD_EyE
  How to change a dataframe column to lower case zhujp98 5 267 Oct-29-2019, 06:42 PM
Last Post: zhujp98
  Split csv file based on column value soli004 4 327 Oct-22-2019, 05:53 AM
Last Post: soli004
  Add a column in a dataframe from another dataframe Bilsix 2 117 Oct-08-2019, 12:55 PM
Last Post: Bilsix
  Importing/loading a library file (.so) tomasby 0 210 Aug-24-2019, 08:13 PM
Last Post: tomasby
  Trying to make column based file from text file scor1pion 7 355 Jul-16-2019, 02:43 PM
Last Post: scor1pion
  Creating a new DataFrame from another DataFrame column Ilangos 1 306 Jun-05-2019, 09:47 AM
Last Post: Ilangos
  Populating a timetable with subjects brittocj 1 186 May-02-2019, 07:00 AM
Last Post: buran

Forum Jump:


Users browsing this thread: 1 Guest(s)