Blog Cover Image

Inspire you to have New thinking, Walk out your unique Road.

有的時候,你無意間遇到的一些故事,會激發你的靈感,改變你的想法,接下來你會用與之前全然不同的觀念去創造屬於你獨特的故事。

Sign @MinaYu.

後端小菜鳥學習記錄(8)

Posted on

10/8

10:10-11:00 學五個函式 1hours

11:00-12:30(1.5hours)/13:30-15:00 (3hours) 完成任務

https://pandas.pydata.org/pandas-docs/stable/api.html#dataframe

https://www.datacamp.com/community/tutorials/pandas-tutorial-dataframe-python

#return first n row > (n)
df = df.head()

#注意這邊的寫法跟loc寫法不同
df = df.at[2,'ID']
df = df.iat()

#df.loc[k]是读取df中index為k的那一行
df = df.loc()
#read specific value(get_value, no index and other)
#df.iloc[k]是读取df中的第k行
df = df.iloc[2][6]

https://blog.csdn.net/wr339988/article/details/65446138

https://stackoverflow.com/questions/17071871/select-rows-from-a-dataframe-based-on-values-in-a-column-in-pandas

git commit --amend

https://pep8-zhtw.readthedocs.io/zh_TW/feature-preface/

18:00-17:00(1hour) 修改程式


10/9

早1.5hours 整理資訊

早30min 專案寫程式

https://stackoverflow.com/questions/15862034/access-index-of-last-element-in-data-frame

<code><span class="pln">df</span><span class="pun">[</span><span class="str">"date"</span><span class="pun">].</span><span class="pln">iloc</span><span class="pun">[-</span><span class="lit">1</span><span class="pun">]</span></code>

https://stackoverflow.com/questions/15943769/how-do-i-get-the-row-count-of-a-pandas-dataframe

<code><span class="pln">count_row </span><span class="pun">=</span><span class="pln"> df</span><span class="pun">.</span><span class="pln">shape</span><span class="pun">[</span><span class="lit">0</span><span class="pun">]</span>  <span class="com"># gives number of row count</span><span class="pln">
count_col </span><span class="pun">=</span><span class="pln"> df</span><span class="pun">.</span><span class="pln">shape</span><span class="pun">[</span><span class="lit">1</span><span class="pun">]</span>  <span class="com"># gives number of col count</span></code>

14:00-17:00 寫程式~~~(3hours)

10/11

10:30-13:00(2.5hours), 14:00-19:20(5.5hours) 全天候寫程式啦~

10/12

10:30-12:30(2hours)

14:00-15:20(1.5hours)

Pandas Docs

Pandas.Series

https://blog.csdn.net/xiaodongxiexie/article/details/53108959

https://stackoverflow.com/questions/41710789/boolean-series-key-will-be-reindexed-to-match-dataframe-index

<span class="hljs-typedef"><span class="hljs-keyword">data</span>.iloc[-1] #选取<span class="hljs-type">DataFrame</span>最后一行,返回的是<span class="hljs-type">Series</span></span>

<span class="hljs-typedef"><span class="hljs-keyword">data</span>.iloc[-1:] #选取<span class="hljs-type">DataFrame</span>最后一行,返回的是<span class="hljs-type">DataFrame</span></span>




<code><span class="pln">df</span><span class="pun">.</span><span class="pln">loc</span><span class="pun">[</span><span class="pln">a_list</span><span class="pun">].</span><span class="pln">query</span></code>




<code><span class="pln">df</span><span class="pun">[</span><span class="pln">df</span><span class="pun">[</span><span class="str">'value'</span><span class="pun">].</span><span class="pln">apply</span><span class="pun">(</span><span class="pln">np</span><span class="pun">.</span><span class="pln">isnan</span><span class="pun">)]</span></code>




df.columns

https://stackoverflow.com/questions/20490274/how-to-reset-index-in-a-pandas-data-frame

<code><span class="pln">df </span><span class="pun">=</span><span class="pln"> df</span><span class="pun">.</span><span class="pln">reset_index</span><span class="pun">()</span></code>