- import polars as pl
- # Read csv1 and csv2
- csv1 = pl.read_csv('csv1.csv')
- csv2 = pl.read_csv('csv2.csv')
- # Specify the column name to check
- column_name = 'column_name' # Replace with the actual column name
- # Extract the column from csv1
- csv1_column = csv1[column_name]
- # Extract the column from csv2
- csv2_column = csv2[column_name]
- # Check if all values in csv1 column are present in csv2 column
- all_present = csv1_column.isin(csv2_column).all()
- # Print the result
- if all_present:
- print("All values in csv1 column are present in csv2 column.")
- else:
- print("Not all values in csv1 column are present in csv2 column.")
- import polars as pl
- # Read the CSV files
- leg = pl.read_csv('Leg.csv')
- cont = pl.read_csv('Cont.csv')
- # Check if each cont_id from Leg is present in Cont
- present_in_cont = leg.join(cont, on='cont_id', how='inner')
- # Get the cont_ids present in both Leg and Cont
- common_cont_ids = present_in_cont['cont_id']
- # Get the cont_ids in Leg that are not in Cont
- not_in_cont = leg.filter(pl.col('cont_id').isin(common_cont_ids), negate=True)
- # Count the number of cont_ids in Leg but not in Cont
- not_in_cont_count = not_in_cont.height()
- # Print the number of cont_ids in Leg but not in Cont
- print("Number of cont_ids in Leg but not in Cont:", not_in_cont_count)
[text] Temp
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: