Discover python data analysis coursera, include the articles, news, trends, analysis and practical advice about python data analysis coursera on alibabacloud.com
This blog is used to record learning and facilitate review review.PyplotIn the Matplotlib object-oriented drawing library, Pyplot is a convenient interface.Basic drawing functionsMp.plot (array of horizontal coordinates, array of vertical coordinates) 1 from __future__ import unicode_literals 2 import NumPy as NP 3 import Matplotlib.pyplot as MP 4 x = Np.linspace (-np.pi, Np.pi, 1000) 5 cos_y = Np.cos (x)/26 sin_y = Np.sin (x) 7 mp.plot (x, cos_y) 8 mp.plot (x, sin_y) 9 m
# mean averaging # std standard deviation # var asks for variance # min to find minimum # Max to find maximum value # argmin Minimum index # argmax Max indexXi. NumPy: Random number generationRandom number generation function within the Np.random sub-packageCommon functions: # Rand Given shape produces a random array (number between 0 and 1)# randint a given shape produces a random integer # Choice The given shape produces a random selection # Shuffle
This paper illustrates the data transmission UDP implementation method of Python network programming. Share to everyone for your reference. The specific analysis is as follows:
First, the question:
Do you think that tools like msn,qq on the Web transmit data mysteriously between machines? You want to play a little bi
] # - ifPattern.search (Invoice_number): # Use the RE module's search function to find patterns in the value of Invoice_number -Filewriter.writerow (row_list) # If the pattern appears in Invoice_number, write the line to the output file
Pandas
1 #! /usr/bin/env Python32 3 ImportPandas as PD4 ImportSYS5 6Input_file = sys.argv[1]7Output_file = sys.argv[2]8 9Data_frame =pd.read_csv (input_file)TenData_frame_value_matches_pattern = data_frame.loc[data_frame['Invoice
Use Python to connect to the central control attendance machine. Download and analyze the data and send the results to the personnel.Central Control SDK Package: x32 Address x64 AddressSDK Package recommended 32-bit, on the Win7 64-bit system with 64-bit development package does not, with 32 can.Python also pywin32 note version, I use the 32-bit Python 2.7 and th
which one is best for use, so let's review it.Concat allows the user to append one or more dataframe (depending on how you define the axis) below or next to the table.Merge merges multiple dataframe to specify the same row as the primary key (key).Join, like merge, incorporates two dataframe. But it does not merge by a specified primary key, but is merged by the same column name or row name.Pandas ApplyApply is designed for the pandas series. If you're not familiar with series, you can think of
areas of the drawing method (one is using the above column chart that way Fig,ax = Plt.subplots), the other is the following, this can be customized to occupy the number of spaces)Fig = plt.figure () Ax1 = Plt.subplot2grid ((2,3), (0,0)) Ax1.bar (data_bar.index,data_bar.values) fig.set_size_inches ( 12,6) Ax2 = Plt.subplot2grid ((2,3), (0,1), colspan=2) #占据几个空额, can also be rowspan, one is horizontal, one is vertical ax2.scatter (data[' Tip '],
Objective
Pandas is a numpy built with more advanced data structures and tools than the NumPy core is the Ndarray,pandas is also centered around Series and dataframe two core data structures. Series and Dataframe correspond to one-dimensional sequence and two-dimensional table structure respectively. Pandas's conventional approach to importing is as follows:
From pandas import series,dataframe
impo
This time will be the next issue of SHUANGSE Qiu number forecast, think of a little excitement ah.
The code uses the linear regression algorithm, which uses this algorithm to predict the effect, and you can consider using other algorithms to try the results.
Before discovering a lot of code is repetitive work, in order to make the code look more elegant, define the function, to call, suddenly tall
#!/usr/bin/python #-*-Coding:utf-8-*-#导入需要的包 Import p
Peacock City Burton Manor Villa owners anxious to sell a key at any time to see the room 7.584 million Yuan/M2 5 Room 2 Hall 315m2 a total of 3 floors 2014 built Tian Wei-min Chaobai River Peacock City Burlington Manor (Villa) Beijing around-Langfang-Houtan line ['Matching Mature','Quality Tenants','High Safety'] gifted mountain Beautiful ground double Garden 200 draw near Shunyi UK* See at any time 26,863,058 Yuan/m2 4 Room 2 Hall 425m2 total 4 stories built in 2008 Li Tootto Yosemite C Area S
1.1. Pandas Analysis steps
Loading data
COUNT the date of the access_time. SQL similar to the following:
SELECT date_format (access_time, '%H '), COUNT (*) from log GROUP by Date_format (access_time, '%H ');
1.2. Code
Cat pd_ng_log_stat.py#!/usr/bin/env python#-*-Coding:utf-8-*-From Ng_line_parser import NglineparserImport Pandas as PDImport socketImport str
specified axisTake and PutRemove a specific element from an arraybroadcasting/BroadcastSpreads along the x-axis and spreads along the y-axis with subtle differencesNp.newaxis () Add new axisAdvanced Ufunc UsageUfunc is the abbreviation for universal function, which is a function that can operate on each element of an array, numpy many of the Ufunc functions are implemented at the C level, so they are computationally fast
Np.add.reduce: Add and operate
Np.add.accumulate: Similar to
variable (local).-python called namespaces-The following functiondef func(): a = [] for i in range(5): a.append(i)-After Func is called, the empty list A is created first, then 5 elements are added, and a is destroyed when the function exits-If we define a as followsa = []def func(): for i in range(5): a.append(i)-Although you can assign a global variable to a function, those variables must be declared as global variables with
1, remove the label of the page, such as from Import beautifulrsoup predata=beautifulsoup (data,'html.parser'). Get_text ()2. Remove punctuation, etc., with regular expressions.Import RE#表示将data中的除了大小写字母之外的符号换成空格preData=re.sub (R'[^a-za-z]',' , data)3. Lowercase the words in the text and separate the data with a space
element is the index of the item whose index number is smaller than the previous one. So we see that the value of index 2,3 is 1, and the value of index 1
If you want to use the element following the newly inserted index, you need to use the Bfill method
The replacement index can be extended from series to dataframe, not only to replace the row index, but also to replace the column index or even replace both
Second, delete
① Deleting a series Pandas specificall
Python Object System in-depth analysis, python system in-depth analysis
This article analyzes in detail the Python object system. Share it with you for your reference. The details are as follows:
Guido uses C language to create Python
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.