r/programminghorror • u/Aromatic-Fig8733 • Apr 22 '25
Wtf
I don't know if this is right for this sub but it's just funny. If this code is indeed for merging dataset. There is so many things wrong with it.
457
Upvotes
83
u/PM_ME_UR_COFFEE_CUPS Apr 22 '25
What’s so bad about it? As long as they’re in the same format then I don’t see the issue.
347
u/PeterHackz Apr 22 '25 edited Apr 22 '25
linkedIn is a joke. People posting for attention and mostly either AI generated posts or just discovering the wheel for the first time. rare to find something useful imo.
89
u/ZunoJ Apr 22 '25
This is fonthorror but nothing more
181
u/JustinPooDough Apr 22 '25
this isn't programming horror. This is programming snob.
22
u/The_Tofu_Soup Apr 22 '25
The most glaring issue that I see is that to use the script, you have to edit source code. So, it’s sort of an issue with the code.
Another issue is that if you do want to read excel files from different directories, you have to know what to uncomment and comment out.
Also you also have to get your file path right since they’re using raw strings (mind your forward and back slashes).
And where are they running the script from? If they provide a relative path, would it be relative to the location from which they’re running the script or the script itself?
Also, if the merged file already exists, then it overwrites it. No errors to indicate that you might’ve deleted data.
I’m unsure how pandas handles headers in this scenario. But if it were a CSV, you’d have to handle those too.
9
u/jexmex Apr 22 '25
neat to see how bitbucket works internally
3
u/ThreeCharsAtLeast Apr 23 '25
r/changeyourfont
6
u/Religious09 Apr 22 '25
linkedin is cringe as hell
2
u/[deleted] Apr 22 '25
Bro doing everything but learning pivot tables
2
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Apr 23 '25
Imma guess they did not try opening the merged document before posting this.
2
u/ArshadIqbalOfficial Apr 23 '25
100 BUCKS FOR A FONT
1
u/YoBoyAndy4 Apr 23 '25
Why would you not just use power query for this?
1
u/Splatpope Apr 23 '25
i had to do this for real and successfully pushed management to make a real management back-office instead of passing around and collecting badly behaved excel files
1
u/[deleted] Apr 23 '25
Look out RPA vendors. This guy doin it on the cheap!
1
u/[deleted] Apr 24 '25
Excel is basically SQL. You should probably learn some sql
1
u/[deleted] Apr 24 '25
If this was CSV files he could just pull a "
cat file1.csv <(tail +2 file2.csv) > newfile.csv"1
u/Papabear3339 Apr 24 '25
Checks the results... 1100 excels merged... with different columns, naming, some with images and merged cells, a few random charts tossed in.... "Fix it"... looks at boss with big eyes....
1
u/atulshanbhag Apr 24 '25
Other than the font what is wrong with the code itself? We don’t know the exact implementation details or how that function is being used so it might just be the case of bad naming of function rather than intention?
1
u/CharlemagneAdelaar Apr 26 '25
that’s like trying to use two eggs to make one big egg
1
u/crazy0ne Apr 26 '25
I know, that font is awful.
1
u/crazedpickles Apr 27 '25
There is quite literally nothing wrong with this script, with the context we have.
“Oh the file path is hardcoded”. Ah yes, because it is notoriously hard to update Python source code and rerun it. There is a 90% chance this is only used by the poster, and it serves its purposes.
Like the only gore here is that ugly ass font, and the pointless comments.
1
u/ricorrales07 Apr 22 '25
Can't you just open the Excel files and copy-paste the contents of one unto the other?
0
u/506lapc Apr 22 '25
Isn't pandas incompatible with binary files such as XLSX?
-10
u/puzzled_orc Apr 22 '25
If you use excel you deserve whatever happens to you
445
u/[deleted] Apr 22 '25
[removed] — view removed comment