Skip to content

Instantly share code, notes, and snippets.

@forAllBright
Last active May 4, 2018 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save forAllBright/911b2753eb3932c3a77b91fdf4ba00e0 to your computer and use it in GitHub Desktop.
Save forAllBright/911b2753eb3932c3a77b91fdf4ba00e0 to your computer and use it in GitHub Desktop.
Python DataFrame基本操作 #Python #Pandas
# 读取 csv 文件,添加标题行
mobi = r"/Users/pmz/Project/MOBIKE_CUP_2017/225W.csv"
df = pd.read_csv(mobi,header=0,names=['time','number'])
print(df.head())
#查看 df 的类型详情
df.dtypes
#取出两列,转换为二维列表
filter1 = filter1[['time_stamp','hot']] #将 dataframe 转化成二维列表,列表外层元素是一行
lis = np.array(filter1).tolist()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment