#!/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()

pj_0001_compare_col_csv的更多相关文章

随机推荐

  1. 工控领域上云实践-Zstack和软赢

    工业以太网常见五大协议对比 大规模电机控制的方案选择-电机和驱动器篇 大规模电机控制的方案选择-控制器篇 工控领域有各种各样的总线来通讯以控制设备,很小众的接口规范慢慢的更小众了,最常见的接口规范就是 ...

  2. Linux基础之用户、组和权限管理

    用户类别分为:普通用户.系统用户.登陆用户 用户标识:UserID, UID 是16bits二进制数字: 0-65535管理员:0普通用户:0-65536系统用户:1-499(CentOS6)1-99 ...

  3. 数值的扩展方法以及新增数据类型BigInt

    二进制和八进制表示法 ES6提供了二进制和八进制数值的新的写法,分别用前缀0b(或0B)和0o或(0O)表示 0b111110111 === 503 // true; 0o767 === 503; / ...

  4. JZOJ 1083. 【GDOI2006】拯救亚特兰蒂斯

    \(\text{Solution}\) 自己的网络流技术太拉了 连这样的题都做不出来 对于一个怪物,剑术和法术两样东西有一样就可以了 不难想到二分图中最小点覆盖,一条边只有两个端点之一被选就被覆盖了 ...

  5. JZOJ 4496. 【GDSOI 2016】第一题 互补约数

    \(\text{Problem}\) 求 \[\sum_{i=1}^n \sum_{d|n} \gcd(d, \frac{i}{d}) \] 有 \(n \le 10^{11}\) \(\text{A ...

  6. Vue中v-model与:value的区别

    v-model不可以加其他值 <input type="text" v-model="curAmount"> :value可以加 单位 <in ...

  7. LeetCode-1219 黄金矿工

    来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/path-with-maximum-gold 题目描述 你要开发一座金矿,地质勘测学家已经探明了这 ...

  8. 按照参数名ASCII码表升序顺序排序,生成签名用

    签名生成方法如下: 对所有请求参数(不包括 signature 参数),按照参数名ASCII码表升序顺序排序.如:foo=1, bar=2, foo_bar=3, baz=4 排序后的顺序是 bar= ...

  9. openssl国密算法库

    openssl国密算法库 一.开发背景 openssl是一个功能丰富且自包含的开源安全工具箱.它提供的主要功能有:SSL协议实现(包括SSLv2.SSLv3和TLSv1).大量软算法(对称/非对称/摘 ...

  10. spring 特性

    1.Aware系列接口 spring 6.0提供了一系列的Aware接口,方便我们在Bean加载时获取信息 如 @Service public class study implements BeanN ...