影像组学学习笔记(2)-pandas基本操作

本笔记来源于B站Up主: 有Li 的影像组学系列教学视频
本节(2)主要介绍: pandas基操

1.导入包

import pandas as pd
import numpy as np
# 导入数据
xlsx1_filePath = 'C:/Users/RONG/Desktop/PythonBasic/data_A.xlsx'
xlsx2_filePath = 'C:/Users/RONG/Desktop/PythonBasic/data_B.xlsx'
data_1 = pd.read_excel(xlsx1_filePath)
data_2 = pd.read_excel(xlsx2_filePath)
# 查看行列数
rows,cols = data_1.shape
print(rows,cols)
# > 10 107
# 查看前10行(默认前5行)
data_1.head(10)
output10.JPG
  1. 查看列名
print(data_1.columns)

Output:

# Index(['original_shape_Elongation', 'original_shape_Flatness',
#       'original_shape_LeastAxisLength', 'original_shape_MajorAxisLength',
#        'original_shape_Maximum2DDiameterColumn',
#        'original_shape_Maximum2DDiameterRow',
#        'original_shape_Maximum2DDiameterSlice',
#        'original_shape_Maximum3DDiameter', 'original_shape_MeshVolume',
#        'original_shape_MinorAxisLength',
#        ...
#        'original_glszm_SmallAreaHighGrayLevelEmphasis',
#        'original_glszm_SmallAreaLowGrayLevelEmphasis',
#        'original_glszm_ZoneEntropy', 'original_glszm_ZonePercentage',
#        'original_glszm_ZoneVariance', 'original_ngtdm_Busyness',
#        'original_ngtdm_Coarseness', 'original_ngtdm_Complexity',
#        'original_ngtdm_Contrast', 'original_ngtdm_Strength'],
#       dtype='object', length=107)

在P2里,李博士演示了如何下载anaconda并在Jupyter notebook中使用python.

推荐阅读更多精彩内容