Skip to content

Instantly share code, notes, and snippets.

@francoisstamant
Created June 3, 2020 18:39
Show Gist options
  • Save francoisstamant/b028530594a9b6094bc409549c5e0bb4 to your computer and use it in GitHub Desktop.
Save francoisstamant/b028530594a9b6094bc409549c5e0bb4 to your computer and use it in GitHub Desktop.
df=pd.DataFrame()
df['hostel']=data[0::11]
df['security']=data[1::11]
df['location']=data[2::11]
df['staff']=data[3::11]
df['fun']=data[4::11]
df['cleanliness']=data[5::11]
df['facilities']=data[6::11]
df['value']=data[7::11]
df['experience']=data[8::11]
df['price']=data[9::11]
df['number_reviews']=data[10::11]
#Remove non-string from 2 columns
df['number_reviews'] = df['number_reviews'].str.extract('(\d+)', expand=False)
df['price'] = df['price'].str.extract('(\d+)', expand=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment