Python是进行数据分析的一种出色语言,主要是因为以数据为中心的python软件包具有奇妙的生态系统。 Pandas是其中的一种,使导入和分析数据更加容易。
Pandas dataframe.ne()函数使用常量,序列或其他按元素排列的 DataFrame 检查 DataFrame 元素的不等式。如果比较中的两个值不相等,则返回true;否则,返回false。
用法: DataFrame.ne(other, axis=’columns’, level=None)
参数:
other:系列,DataFrame或常量
axis:对于系列输入,轴与系列索引匹配
level:在一个级别上广播,在传递的MultiIndex级别上匹配索引值
返回:结果:DataFrame
范例1:采用ne()用于检查序列和 DataFrame 之间是否不相等的函数。
# importing pandas as pd
import pandas as pd
# Creating the first dataframe
df1=pd.DataFrame({"A":[14,4,5,4,1],
"B":[5,2,54,3,2],
"C":[20,20,7,3,8],
"D":[14,3,6,2,6]})
# Print the dataframe
df1
让我们创建系列
# importing pandas as pd