pandas 基本使用

数据处理

  • pandas.DataFrame.sample 随机选取若干行。 df.sample(n=3,random_state=1) 提取3行数据列,使用random_state,以确保可重复性使用。

  • Pandas中DataFrame基本函数整理(全)

  • 同时处理不同列的数据

      def my_test(a, b):
          return a + b
        
      df['label'] = df.apply(lambda row: my_test(row['a'], row['b']), axis=1)
      print(df)
    

文档信息

Search

    Table of Contents