Skip to content

Instantly share code, notes, and snippets.

@canwe
Created April 19, 2018 09:40
Show Gist options
  • Save canwe/dd4f2e58d202865415ae47e768681a84 to your computer and use it in GitHub Desktop.
Save canwe/dd4f2e58d202865415ae47e768681a84 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
"""
create DataFrame object
@author: Dazhuang
"""
import pandas as pd
music_data = [("the rolling stones","Satisfaction"),("Beatles","Let It Be"),("Guns N' Roses","Don't Cry"),("Metallica","Nothing Else Matters")]
music_table = pd.DataFrame(music_data)
music_table.index = range(1, 5)
music_table.columns = ['singer', 'song_name']
print(music_table)
@canwe
Copy link
Author

canwe commented Apr 19, 2018

           singer             song_name

1 the rolling stones Satisfaction
2 Beatles Let It Be
3 Guns N' Roses Don't Cry
4 Metallica Nothing Else Matters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment