Cris 的 Python 数据分析笔记 07:Pandas 中的 Series 数据结构

# Series (Collection of values)
# DataFrame (Collection of Series Objects)
'''
    Pandas 读取的 csv 文件会形成一个 DataFrame 数据结构,其中的每行就是一个 Series 数据结构,每列同样是一个 Series 数据结构
'''
1. DataFrame 和 Series 关系
import pandas as pd

fandago = pd.read_csv('fandango_score_comparison.csv')
print(type(fandago))
series_film = fandago['FILM']
print(type(series_film))
print(series_film[0:5])
print('---------------')
print(fandago['RottenTomatoes'][0:5])
<class 'pandas.core.frame.DataFrame'>
<class 'pandas.core.series.Series'>
0    Avengers: Age of Ultron (2015)
1                 Cinderella (2015)
2                    Ant-Man (2015)
3            Do You Believe? (2015)
4     Hot Tub Time Machine 2 (2015)
Name: FILM, dtype: object
---------------
0    74
1    85
2    80
3    18
4    14
Name: RottenTomatoes, dtype: int64
2. 新建 Series 数据结构(key 和 value)
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值