Use Python for your Excel tasks to be quicker and more efficient

Joined July 2022
1 Photos and videos
One liner for pandas to manipulate data: 1. Read data from a CSV   df = pd.read_csv('data.csv') 2. Remove columns with null values df.drop(df.columns[df.isnull().sum() > 0], axis=1, inplace=True)

1
72
5. Filter rows based on specific values df.loc[df['col'] == 'value'] 6. Sort a DataFrame by a specific column df.sort_values(by='col_name', ascending=False) 7. Fill all null values   df.fillna(0)
1
76
8. Remove duplicate rows   df.drop_duplicates() 9. Create a pivot table df.pivot_table(index='col_1', columns='col_2', values='col_3’) 10. Save to CSV file   df.to_csv('new_data.csv', index=False) That’s it! #pythonprogramming #pythonlearning

54
Ever since I started using python 3.9 I received the following error when reading xlsx files: “Excel file format cannot be determined, you must specify an engine manually.” Here is how you solve it:
1
57
Most answeres on the Internet will tell you to close all hidden files in the folder. However, that didn’t solve it for me. I kept receiving the error. Instead I think the best way is to “ignore” all hidden files.
1
52
I used: import os for file in os.listdir(folder path): if not file.startswith("~") and file.endswith(".xlsx"): print(file) And this solved it for me! #pythonprogramming #Python
1
52
Writing clean code in #Python is important because code is a communication tool between humans. Here is how you do it:
1
62
1) Use Docstrings 2) Know PEP 8 (Python Enhancement Proposal) 3) Read Google Python Style Guide 4) Linters help to find small coding mistakes. Use them. 5) There are automatic code formatters that do the styling for you.
1
67
For a comprehensive overview go to: amr-khalil.medium.com/how-to…

52
How to make a twitter bot in Python 101:#pythonprogramming #TwitterBot 👇🏻
1
82
1.Get a developer account, a ‘project’ and an ‘app’ to register your bot with Twitter. 2. Twitter will give you several keys that your bot will use to access its API. 3. Once you have those you can start programming:
1
60
It’s difficult to imagine how ChatGPT is not going to make google redundant. #chatgpt3
117