0

How can I perform case-insensitive comparison of array of different data types in python?

Problem: Basically I'm comparing arrays, and array have different data types in it i.e.

Array1 = [1, 2.9, "Hello"], Array2 = [1, 2.9, "hello"]

I need a solution where Array1==Array2 should give me true ignoring the case sensitiveness.

What I already tried: I did some research and found something like I should convert both arrays in lower or uppper case, and then compare but this is affecting the performance as I'm already comparing 2,3 Billion of arrays :)

  • https://stackoverflow.com/a/29247821/1084416 – Peter Wood Jun 16 '22 at 10:31
  • Are your strings always ASCII? – Peter Wood Jun 16 '22 at 10:32
  • I already mentioned in my query that using lower or upper does not solve my problem, so this is not a duplicate question. As I'm comparing 1 array with another, which have like 20 types of different data types in it like int, string or boolean etc. This is a refernce line I'm using for array comparison. || if list(rowsSQLServer[x]) != list(rowsPostgreSQL[x]): || – Muhammad Ehtsham Jun 16 '22 at 12:18
  • @PeterWood Yes I think. Basically I'm comparing database tables row by row. – Muhammad Ehtsham Jun 16 '22 at 12:20
  • Is it not easier to do it in the database query? Also, as the conversion has to be done somewhere, it's unlikely you'll hit upon some solution which gives you massive performance gains. – Peter Wood Jun 16 '22 at 19:26
  • @PeterWood it sounds great. But is it possible to compare data of heterogeneous databases using database query or link server? One is MSSQL Server and other is PostgreSQL. – Muhammad Ehtsham Jun 16 '22 at 21:19

0 Answers0