<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                [TOC] # 大小寫轉換 ~~~ s = pd.Series(['A', 'b', 'B', 'gaer', 'AGER', np.nan]) # print(s.str.upper()) print(s.str.lower()) ~~~ 輸出 ~~~ 0 a 1 b 2 b 3 gaer 4 ager 5 NaN dtype: object ~~~ # 計算長度 ~~~ s = pd.Series(['A', 'b', 'B', 'gaer', 'AGER', np.nan]) print(s.str.len()) ~~~ # 去空格 ~~~ index = pd.Index([' tang', ' yu ', 'di ']) print(index.str.strip()) print(index.str.lstrip()) print(index.str.rstrip()) ~~~ 輸出 ~~~ Index(['tang', 'yu', 'di'], dtype='object') Index(['tang', 'yu ', 'di '], dtype='object') Index([' tang', ' yu', 'di'], dtype='object') ~~~ # 修改列名 ~~~ df = pd.DataFrame(np.random.randn(3, 2), columns=['A a', 'B b'], index=range(3)) print(df) df.columns = df.columns.str.replace(' ', '_') print(df) ~~~ 輸出 ~~~ A a B b 0 0.529066 0.635890 1 1.643041 -0.540741 2 -0.066216 -0.076341 A_a B_b 0 0.529066 0.635890 1 1.643041 -0.540741 2 -0.066216 -0.076341 ~~~ # 切割字段 ~~~ s = pd.Series(['a_b_C', 'c_d_e', 'f_g_h']) print(s) print(s.str.split('_')) print(s.str.split('_', expand=True)) # 只切一次 print(s.str.split('_', expand=True, n=1)) ~~~ 輸出 ~~~ 0 a_b_C 1 c_d_e 2 f_g_h dtype: object 0 [a, b, C] 1 [c, d, e] 2 [f, g, h] dtype: object 0 1 2 0 a b C 1 c d e 2 f g h 0 1 0 a b_C 1 c d_e 2 f g_h ~~~ # 是否包含某個元素 ~~~ s = pd.Series(['A', 'Aas', 'Afgew', 'Ager', 'Agre', 'Agre']) contains = s.str.contains('Aas') print(contains) ~~~ 輸出 ~~~ 0 False 1 True 2 False 3 False 4 False 5 False dtype: bool ~~~ # 分割統計 ~~~ s = pd.Series(['a', 'a|b', 'a|c']) print(s) dummies = s.str.get_dummies(sep="|") print(dummies) ~~~ 輸出 ~~~ 0 a 1 a|b 2 a|c dtype: object a b c 0 1 0 0 1 1 1 0 2 1 0 1 ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看