xxxxxxxxxx
import pandas as pd
# Create two DataFrames
data1 = {
'id': [1, 2, 3, 4],
'A': ['A0', 'A1', 'A2', 'A3'],
'B': ['B0', 'B1', 'B2', 'B3'],
'C': ['C0', 'C1', 'C2', 'C3']
}
data2 = {
'id': [1, 2, 3, 4],
'B': ['B0', 'B1', 'B2', 'B3'],
'C': ['C4', 'C5', 'C6', 'C7'],
'D': ['D4', 'D5', 'D6', 'D7']
}
df1 = pd.DataFrame(data1)
df2 = pd.DataFrame(data2)
# Find the columns unique to df2
unique_cols_df2 = set(df2.columns) - set(df1.columns)
# Merge the DataFrames on the 'id' column and keep only the unique columns from df2
df_merged = pd.merge(df1, df2[['id'] + list(unique_cols_df2)], on='id')
print(df_merged)
xxxxxxxxxx
df_outer = pd.merge(df1, df2, on='id', how='outer') #here id is common column
df_outer
xxxxxxxxxx
pip install pyinstaller
pyinstaller <file name>.py
pyinstaller --onefile <file name>.py
xxxxxxxxxx
pyinstaller --onefile --windowed --icon=<project-logo>.ico --add-data "<folder>;<folder>" <filename.py>
xxxxxxxxxx
merged_df = DF2.merge(DF1, how = 'inner', on = ['date', 'hours'])
xxxxxxxxxx
#suppose you have two dataframes df1 and df2, and
#you need to merge them along the column id
df_merge_col = pd.merge(df1, df2, on='id')
xxxxxxxxxx
# the exe is in the dist folder
pyinstaller file.py # Basic programs
pyinstaller --noconsole file.py # GUI programs
pyinstaller --noconsole --onefile file.py # GUI programs with just one file