Skip to main content

Posts

get the moving average value with pandas

file['Date']=[d.date() for d in file['DateTime']]#add the date collumn DFList = [] for group in file.groupby(file['Date']):#split the dataframe according to the date      DFList.append(group[1]) len(DFList) testMA = DFList[0]['Close'].rolling(window=5).mean()[4:]#get the moving average by using the rolling method of pandas print(len(testMA)) print(len(DFList[0]['Close']))

C# client talking to python server with double converting to bytes

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Net.Sockets; using System.Net; namespace Client {     class Program     {         static Socket ClientSocket;         static void Main(string[] args)         {             String IP = "127.0.0.1";             int port = 9999;             IPAddress ip = IPAddress.Parse(IP);  //将IP地址字符串转换成IPAddress实例             ClientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);//使用指定的地址簇协议、套接字类型和通信协议             IPEndPoint endPoint = new IPEndPoint(ip, port); // 用指定的ip和端口号初始化IPEndPoint实例             ClientSocket.Connect(endPoint);  //与远程主机建立连接             Console.WriteLine("开始发送消息");             byte[] message = Encoding.ASCII.GetBytes("Connect the Server");  //通信时实际发送的是字节数组,所以要将发送消息转换字节             double a = 0.0000008900056;             byte[]

python socket server

#!/usr/bin/env python # -*- coding: utf-8 -*- import socket import threading bind_ip = "127.0.0.1" bind_port = 9999 server = socket.socket(socket.AF_INET,socket.SOCK_STREAM) server.bind((bind_ip,bind_port)) server.listen(50) print("[*]Listening on %s:%d"%(bind_ip,bind_port)) # 调用处理线程 def handle_client(client_socket):     request = client_socket.recv(1024)     print("[*]Received : %s"%request)     #送回一些服务器给客户端的悄悄话     client_socket.send("收到了,小乖乖!")     client_socket.close() while True:     client,addr = server.accept()     print("[*]收到连接,地址:%s:%d"%(addr[0],addr[1]))     client_handler = threading.Thread(target=handle_client,arg_str=(client,))     client_handler.start()

A man in Hunan China suspected of killing his wife and fleeing

On the afternoon of October 19, Modern women's newspaper learned from the relevant departments of Sangzhi County, Zhangjiajie, Hunan, China, that a major criminal case occurred in the county's Badongongshan Town at noon today. A woman surnamed Tian died 100 meters away from the her house door. After investigation by the local police department, Wang Yong, the husband of the victim, was suspected of committing the major crime. Wang Yong is now at large. The reporter learned that at 10:31 on the 19th, Tian also made a self-video of tik-tok in the Moments of WeChat . The text was: " Could you let go  of me? I want to get rid of all, I beg you to let go, don't torture me anymore, I am tired and hurt. " After more than an hour of the Moments of WeChat, Tian was found to be stabbed to death by a hundred meters near her home. What is weird is that, about two hours after Tian sent the Moments on Wechat, Tian's husband, Wang Yong, also sent a Mo

Python crawlers to crawl pure girl pictures

Before running the code, you need to install BeautifulSoup, requests, os library. From bs4 import BeautifulSoup Import requests Import time Import os Def get_html(url):     Try:         Response=requests.get(url)         Response.encoding='gb2312'         If response.status_code==200:             Print('Successfully connected! URL is '+url)             Return response.text     Except requests.RequestException:        Return None Def get_url_and_name(url):     "The passed argument is the main page link, the return value is a list with 2 elements, element 1 is the map package link, and element 2 is the map package name."     Html=get_html(url)     Soup=BeautifulSoup(html,'lxml')     Name=[]     Url_1=[]     List2=soup.find_all(class_='t')     Sign=1     For item in list2:         If(sign!=1 and sign!=42):             Url_temp=item.find('a').get('href')             Name_temp=

Chinese men brutally killed his business partner in Cambodia and split his body

Recently, Cambodian police found a part of a Chinese man's body in a wasteland in Westport. After the investigation, the police arrested the victorious man ZHOU YAYUN at a currency exchange shop in Westport. It is reported that both the murderer and the victim are engaged in money exchange business, or a murder case for $70,000. The court stated that the murderer was facing life imprisonment. According to reports, the victim was WU CHENGHUI, male, 24 years old. Some of his remains were discovered by villagers in Xigang on October 1. After checking the crime scene and collecting evidence, the police identified the identity of the suspect and arrested him near his currency exchange shop in the Fourth Commune. The murderer is ZHOU YAYUN, male, 29 years old, engaged in currency exchange business and lives in the Jiangsu Changan province currency exchange shop. ZHOU YAYUN confessed the crime under the police's trial. He has been doing business with the deceased.

Is Russia‘s “de-dollarization” worth it?

2018 is Russia's first year of trying to move from the dollar to other currencies, it lost a potential return of about $7.7 billion. The Russian central bank increased its exposure to underperforming currencies such as the euro and the RMB, while it missed a 6.5% rise in the dollar. So, is the price of this "de-dollarization" in Russia worthwhile? In fact, Putin's dollarization is also a last resort. Due to the Crimean crisis, the US economic sanctions against Russia have not stopped, and even continue to strengthen. By March 2018, after the "double-sided spy poisoning case" in the United Kingdom, the United States continued to strengthen economic sanctions against Russia. For example, many state-owned energy companies and senior government officials in Russia have been listed on the sanctions list by the United States. Of course, as a reflection of the US economic sanctions, Russia has also made three major "de-dollarization" events