For those who want to learn Excel VBA and get started with Python

I started learning Python. I'm thinking of studying almost on my own. Those who want to see it are as the title. In this article, I would like to post articles and sites that I referred to. (Updated 3/3/2020)

Let's process and format data only with pandas

If you look into it, there are many modules that process like Excel VBA. It is shown below. I tried various things, but in the end I thought that only pandas would be enough. Please let me know if there is any advantage to using other modules.

qiita.py


import csv
import openpyxl
import pandas as pd

Try opening a csv file or Excel file with open ()

First, open the csv file. I think you can also go with numpy. I will omit the result.

qiita.py


import pandas as pd

with open('Desktop/test.csv', encoding="utf-8") as f:
    for row in f:
        print(row)

or

import pandas as pd

with open('Desktop/test.csv', encoding="utf-8") as f:
    print(f.read())

Read or write a csv file or an Excel file

It is convenient to use skiprows and usecols when reading because the data can be formatted. I think it's a good idea to monitor the data you want to extract while looking at print ().

qiita.py


import pandas as pd

data = pd.read_csv("Desktop/test.csv", encoding="utf-8", skiprows=259, usecols=[1,6])
print(data)
data.to_csv("Desktop/test.csv")

Recommended Posts

For those who want to learn Excel VBA and get started with Python
5 Reasons Processing is Useful for Those Who Want to Get Started with Python
For those who want to write Python with vim
A modern environment building procedure for those who want to get started with Python right away
Python techniques for those who want to get rid of beginners
Join Azure Using Go ~ For those who want to start and know Azure with Go ~
Link to get started with python
How to get started with Python
For those who want to start machine learning with TensorFlow2
Introduction to Python for VBA users-Calling Python from Excel with xlwings-
The first step of machine learning ~ For those who want to implement with python ~
❤️ Bloggers ❤️ "Beloved BI" ❤️ Let's get started ❤️ (For those who can make charts with Python)
Environment construction for those who want to study python easily with VS Code (for Mac)
[Short sentence] easygui for those who want to use a simple GUI with Python very easily
A layman wants to get started with Python
Let's get started with Python 3. ~ For kittens who are wondering what to choose as their main language ~
Getting Started with Processing and p5.js (for those who have done other languages) 02
How to get started with the 2020 Python project (windows wsl and mac standardization)
Tips for those who are wondering how to use is and == in Python
Getting Started with python3 # 2 Learn about types and variables
I want to handle optimization with python and cplex
I tried to get started with blender python script_Part 01
I tried to get started with blender python script_Part 02
Anxible points for those who want to introduce Ansible
For those who are new to programming but have decided to analyze data with Python
Get started with Python! ~ ② Grammar ~
For those who should have installed janome properly with Python but get an error
Minimum knowledge to get started with the Python logging module
How to learn TensorFlow for liberal arts and Python beginners
Reference reference for those who want to code in Rhinoceros / Grasshopper
Get additional data to LDAP with python (Writer and Reader)
For those who want to display images side by side as soon as possible with Python's matplotlib
Recursively get the Excel list in a specific folder with python and write it to Excel.
Get started with Python! ~ ① Environment construction ~
Getting Started with Python for PHPer-Classes
How to get started with Scrapy
How to get started with Django
I want to debug with Python
Getting Started with Python for PHPer-Functions
Get started with Python in Blender
PyPI registration steps for those who want to make a PyPI debut
I want to solve APG4b with Python (only 4.01 and 4.04 in Chapter 4)
[Python] A memo that I tried to get started with asyncio
Python environment construction 2016 for those who aim to be data scientists
Loose articles for those who want to start natural language processing
A memo for those who want quick socket communication with netcat
Step notes to get started with django
Getting Started with python3 # 1 Learn Basic Knowledge
Memo to ask for KPI with python
I tried to get started with Hy
[Python] To get started with Python, you must first make sure you can use Python.
How to get the date and time difference in seconds with python
Convert Excel data to JSON with python
Fractal to make and play with Python
I want to analyze logs with Python
Search for Twitter keywords with tweepy and write the results to Excel
I analyzed Airbnb data for those who want to stay in Amsterdam
I want to play with aws with python
Getting Started with Python for PHPer-Super Basics
Get started with Python in 30 minutes! Development environment construction & learn basic grammar
Get Started with TopCoder in Python (2020 Edition)