Python Forum
Importing file in dataframe and populating missing column name
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
Reply


Messages In This Thread
Importing file in dataframe and populating missing column name - by vvv - Feb-26-2017, 10:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding PD DataFrame column bsben 2 328 Mar-08-2024, 10:46 PM
Last Post: deanhystad
  Help copying a column from a csv to another file with some extras g0nz0uk 3 475 Feb-01-2024, 03:12 PM
Last Post: DeaD_EyE
  Python Alteryx QS-Passing pandas dataframe column inside SQL query where condition sanky1990 0 750 Dec-04-2023, 09:48 PM
Last Post: sanky1990
  Difference one column in a dataframe Scott 0 645 Feb-10-2023, 08:41 AM
Last Post: Scott
  splitting a Dataframe Column in two parts nafshar 2 964 Jan-30-2023, 01:19 PM
Last Post: nafshar
  Converting a json file to a dataframe with rows and columns eyavuz21 13 4,524 Jan-29-2023, 03:59 PM
Last Post: eyavuz21
  How to read csv file update matplotlib column chart regularly SamLiu 2 1,074 Jan-21-2023, 11:33 PM
Last Post: SamLiu
  New2Python: Help with Importing/Mapping Image Src to Image Code in File CluelessITguy 0 729 Nov-17-2022, 04:46 PM
Last Post: CluelessITguy
  How to assign a value to pandas dataframe column rows based on a condition klllmmm 0 849 Sep-08-2022, 06:32 AM
Last Post: klllmmm
  renaming the 0 column in a dataframe Led_Zeppelin 5 1,563 Aug-16-2022, 04:07 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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