Compare commits

..

No commits in common. "f3aa4d781b3c8a34ce3460237b81e04e59bb6e51" and "5333f111ddcc0f5b1e322a32ffc1a1219caf4075" have entirely different histories.

3 changed files with 4 additions and 8 deletions

2
.gitignore vendored
View File

@ -1,5 +1,3 @@
app/__pycache__/
app/.flask_session/
.flask_session/
venv/
.env

View File

@ -27,7 +27,7 @@ def get_dataframe(key):
return df
def get_merged_df(table_name): # return table_name: str
def get_merged_df(table_name):
"""
Return a DataFrame for the given table_name based on Stripe and Raisenow inputs,
enforcing strict one-to-one matching with:
@ -36,7 +36,7 @@ def get_merged_df(table_name): # return table_name: str
- no pandas merge suffixes at all
- all original columns (including Raisenow's norm_zweck) preserved
"""
print('calculated DataFrame')
# --- load & normalize Stripe ---
stripe_import = get_dataframe('stripe_import')
@ -339,12 +339,10 @@ def upload():
return jsonify({'error': 'No files uploaded'}), 400
for f in files:
print('uploading file:', f.filename)
raw = (
pd.read_csv(f) if f.filename.lower().endswith('.csv') else pd.read_excel(f)
)
raw = raw.dropna(how='all').dropna(axis=1, how='all')
print('number of rows:', len(raw))
raw = raw.astype(object).replace({np.nan: None})
cols = list(raw.columns)
if cols[:len(STRIPE_STARTING_COLS)] == STRIPE_STARTING_COLS:
@ -369,9 +367,9 @@ def upload():
@app.route('/get_table')
def get_table():
table = request.args.get('table')
print('get_table:', table)
df = get_merged_df(table)
print('number of rows:', len(df))
df = df.astype(object).where(pd.notnull(df), None)
return jsonify({
'columns': list(df.columns),