Tackle_0 最开始的Blog Kaggle_Titanic_准备最基本的技能

Tackle_0 最开始的Blog Kaggle_Titanic

读取CSV

你好!我好!
这是第一篇博客,在个人网站没有建起来之前,现在CSDN发一些值得总结的学习笔记(ROS\DL…)

这篇主要是学习关于Titanic的准备工作。包括如何读取data等

找到CSV

从Notebook给出的代码可以看到:

for dirname, _, filenames in os.walk('/kaggle/input'):
    for filename in filenames:
        print(os.path.join(dirname, filename))

这段代码打印出了所有的data的路径。主要遍历手段是os.walk
那么os.walk是什么?
这篇给出了一个形象的图片
可以看到os.walk返回了一个元组,他将每一层的文件和文件夹分开存放。优先在每一个孩子节点下遍历到底。(深度优先???
而Titanic的data比较简单,全都在/kaggle/input下,所以结果便是

/kaggle/input/titanic/train.csv
/kaggle/input/titanic/test.csv
/kaggle/input/titanic/gender_submission.csv

而通常,遍历文件的时候,常使用如下代码:

for parent, dir_names, file_names in os.walk(person_dir):
    for file_name in file_names:
        print file_name

Notebook的写法用 _ 隐去了dir_names

读取CSV

那么找到了CSV的位置,我又该如何读取它呢?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
const ServerParam & SP = ServerParam::i(); const int self_min = wm.interceptTable()->selfReachCycle(); const int mate_min = wm.interceptTable()->teammateReachCycle(); int opp_min = wm.interceptTable()->opponentReachCycle(); const PlayerObject * opp_fastest = wm.interceptTable()->fastestOpponent(); if ( opp_fastest && opp_fastest->goalie() && wm.gameMode().isPenaltyKickMode() && opp_fastest->pos().dist( wm.ball().pos() ) >= 3.0 ) // MAGIC NUMBER { M_tackle_situation = false; M_opponent_ball = false; dlog.addText( Logger::TEAM, __FILE__":(update) penalty shootouts. not a tackle situation" ); return; } if ( opp_fastest && wm.gameMode().isPenaltyKickMode() && ! opp_fastest->goalie() ) { const AbstractPlayerObject * opponent_goalie = wm.getTheirGoalie(); if ( opponent_goalie ) { /* //yz del std::map< const AbstractPlayerObject*, int >::const_iterator player_map_it = wm.interceptTable()->playerMap().find( opponent_goalie ); if ( player_map_it != wm.interceptTable()->playerMap().end() ) { // considering only opponent goalie in penalty-kick mode opp_min = player_map_it->second; dlog.addText( Logger::TEAM, __FILE__":(update) replaced min_opp with goalie's reach cycle (%d).", opp_min ); } else { opp_min = 1000000; // practically canceling the fastest non-goalie opponent player dlog.addText( Logger::TEAM, __FILE__":%d: (update) set opp_min as 1000000 so as not to consider the fastest opponent.", __LINE__ ); } */ } else { opp_min = 1000000; // practically canceling the fastest non-goalie opponent player dlog.addText( Logger::TEAM, __FILE__":%d (update) set opp_min as 1000000 so as not to consider the fastest opponent.", __LINE__); } }
07-25

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值