Python programming

Using python to analyze the social network in Under the Brocade (1)

I have a social network analysis homework, and I want to imitate this [Python implementation of the social network analysis of “Everything is Good”] to do a social network analysis of “Under the Brocade”. The reason why I chose Under the Jinyi is because I like watching this drama so much hahaha~~hic~ cough … I …

Using python to analyze the social network in Under the Brocade (1) Read More »

Python crawler introductory tutorial crawling webpage pictures (available for pro test)

Preparation Language: python IDE:pycharm The first is the library to be used, because it is the easiest program to get started with, we mainly use the following two: import requests //Used to request web pages import re //Regular expressions used to parse and filter information in web pages Among them, re is included with python, …

Python crawler introductory tutorial crawling webpage pictures (available for pro test) Read More »

keras custom padding tf.keras.layers.ZeroPadding2D

​ introduce Fill 0’s around the 2D matrix Application scenarios In the convolution operation, it is generally used to padding=’SAME’pad 0, but sometimes it is not flexible. We want to perform the zero-padding operation ourselves. At this time, we can usetf.keras.layers.ZeroPadding2D grammar __init__( padding=(1, 1), data_format=None, **quargs ) parameter padding: integer, or tuple of 2 …

keras custom padding tf.keras.layers.ZeroPadding2D Read More »

Fail-safe, parallel memory reduction

Parallelization saves [memory] refer to this link """reducing.py Author: Kirgsn, 2018 Use like this: >>> import reducing >>> df = reducing.Reducer().reduce(df) """ import numpy as np import pandas as pd import time import gc from joblib import Parallel, delayed from fastprogress import master_bar, progress_bar __all__ = ['Reducer'] def measure_time_mem(func): def wrapped_reduce(self, df, *args, **kwargs): # …

Fail-safe, parallel memory reduction Read More »

[python] How to display the data after groupby()

If you directly take the data after groupby, you will get an address, similar to this < [pandas] .core.groupby.groupby.DataFrameGroupBy object at 0x000001F35C0BAB00>, you cannot see the data inside full display # Count the experimental class schedule for each class data.groupby( 'class' ).apply( lambda x:x) The output is See the results in the first few lines …

[python] How to display the data after groupby() Read More »

Python crawler crawls Anju guest room source information

Crawl Anju room source information Installation of Xpath plugin Crawling the listing information near Chongqing Huaxi (enter the topic~) Sort out the logic General process of crawling data code Code problems & possible runtime problems result Data processing part (write to myself~) [Installation of Xpath] plugin Link: https://pan.baidu.com/s/1T3V11Ev8dPODa2fCRbeuCg Extraction code: qvzf Unzip this installation package …

Python crawler crawls Anju guest room source information Read More »

Use Python to encrypt mobile phone numbers, super simple

[Simple encryption] of mobile phone numbers with Python Knowledge points: file read and write Basic grammar String handling regular expression code section # Import system packages import platform import re print( "Hello, Xiuer" ) print( "Simple encrypted phone number" ) # define text content content = """ Uzi: 18845678888, Stains: 19965431111 Jane Pride: 17712348888, Brother …

Use Python to encrypt mobile phone numbers, super simple Read More »

Python collects ip proxy and detects whether it is available (only for learning and communication)

Article directory why use ip proxy The basic idea Code display Video display why use ip proxy We write a [crawler] program. If we crawl too much or request to crawl data quickly, the server will refuse access. At the same time, if an IP is requested several times quickly, the website will block your …

Python collects ip proxy and detects whether it is available (only for learning and communication) Read More »

Life is too short, 5 python tips to save your life

Python is a powerful and easy-to-use language, with concise and elegant syntax, not as cumbersome and nonsense as Java, and there are some special functions or syntax that can make the code shorter and more concise. This article will introduce you to 5 commonly used python tips: String manipulation list comprehension lambda and map() functions …

Life is too short, 5 python tips to save your life Read More »