#!/usr/bin/python
# -*- coding: UTF-8 -*-

import pathlib
import pandas as pd

print("please input the 1stfile to compare")
csv_from = input()

print("please input the compare column")
from_col = input()

print("please input the 2ndfile to compare")
csv_to = input()

print("please input the compare column")
to_col = input()

print(csv_from)
print(from_col)
print(csv_to)
print(to_col)

#check csv

def _compare_csv():
df_from = pd.read_csv(csv_from)
df_to = pd.read_csv(csv_to)

lcol_from = list(df_from[from_col])
lcol_to = list(df_to[to_col])

print("column size of 1st csv is:", len(lcol_from))
print("column size of 2nd csv is:", len(lcol_to))

s1 = set(lcol_from)
s2 = set(lcol_to)

ss1 = s1 - s2
ss2 = s2 - s1
print("1st csv - 2nd csv is",ss1)
print("2nd csv - 1st csv is",ss2)

# ex
print("get other col item?")
q1 = input()
if q1 == 'no':
return

print("get from col or to col?")
q2 = input()

print("give me a col name")
col_name = input()

if q2 == 'from':
lcol_other = list(df_from[col_name])
ss_other = ss1
lcol_ref = lcol_from
else:
lcol_other = list(df_to[col_name])
ss_other = ss2
lcol_ref = lcol_to

#ex for 1st - 2nd
print("ex col value is:")
lout = []
for i in ss_other:
lout.append(lcol_other[lcol_ref.index(i)])

print("other col items is:", lout)
print("for un_repetition", set(lout))

if __name__ == '__main__':
_compare_csv()

最新文章

  1. Linux 命令快捷键
  2. DOCTYPE声明的作用是什么?严格模式与混杂模式如何区分?
  3. 每日Scrum(9)
  4. Web Worker
  5. Js 中json简单处理
  6. Python之练习Demo
  7. python 单元测试
  8. WCF 接收我服务的 HTTP 响应时发生错误
  9. gridview两列数据的互换
  10. tomcat源代码Catalina
  11. 监听 window.open 打开的窗口关闭并回调
  12. Objective-C 和 Swift 混编项目的小 Tips(一)
  13. 通过SMTP发送邮件的Python代码
  14. Beta冲刺Day3
  15. Python内置函数(55)——globals
  16. HBase replication
  17. java基础-String不可变的好处
  18. MySQL之记录相关操作
  19. 【C#复习总结】dynamic
  20. bzoj1233 单调队列优化dp

热门文章

  1. Consul+SpringCloud微服务(入门三)
  2. 自抗扰(ADRC)控制原理及控制器设计
  3. 跨平台C++ DLL导出宏
  4. Word12 财务部制作本年年度报告office真题
  5. 前端JavaScript深拷贝的三种方法,看了不后悔!!!
  6. N63050 第一周运维作业
  7. reids 启动方法
  8. QT 连接SQLIte数据库
  9. vue学习 第三天css基础
  10. 浅谈hive