In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you an analysis of how to carry out iPhone walking data. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.
I will show how to use pandas and ggplot to analyze iPhone walking data, and I mainly use Rodeo (Yhat's 's IDE) for data analysis.
Data collection
First of all, I want to export walking data for analysis from my iPhone. Quantified Self lab staff have developed a convenient tool for data extraction-QS Access.
The following is a set of screenshots of walking data:
The QS Access application can extract an CSV file containing walking data for a certain period of time, which contains three columns of variables-the start point, the end point, and the number of steps.
Data analysis
I mainly use time series analysis tools in pandas to analyze data, and when Wes McKinney started working on the pandas project, he already worked for an investment management company, and the industry relied heavily on time series analysis methods. Therefore, pandas contains a lot of time series analysis functions.
First of all, when we have the time series data, we can define the parameter parse_dates so that pandas can process the time series data correctly. For us, the end-point variable does not contain additional valuable information, so we will not consider the case of the variable in the analysis process.
* We set the start point variable as the index variable, which is helpful for further data analysis.
Hourly walking data
How to quickly draw and analyze existing walking data?
Unfortunately, we can't get more valuable information from the image above, so how can we improve the visualization? I have a good idea-- we can use the resample function in pandas to change the time granularity of the dataset.
To be more precise, we can use downsampling's method to reduce the frequency of time. For example, we can collect hourly data, and then use resampling and summary calculation methods to obtain daily data, weekly data and monthly data.
Get daily walking data
From the picture above, we can see that there is an upward trend in the number of steps per day, and the longer the walking distance with the passage of time.
Get weekly and monthly walking data
As with the above code, you can get weekly and monthly walking data simply by passing W and M into the resample function.
Since I am more concerned about daily exercise, I will use the average function to calculate the average daily walking per week or month. The specific code is as follows:
A deeper analysis.
One thing I am curious about is whether the amount of exercise on weekdays is greater than that on weekends. We can use weekday and weekday_name to help with the analysis. For each timestamp data, the former can know the day of the week, while the latter can know the time name information corresponding to that time point. After adding these two new variables, we can also add a Boolean variable to indicate whether a point in time is a weekend.
In addition, we can also do classified summary processing according to the variable weekend_bool, and compare the differences between the two groups of data.
As can be seen from the above results, the average number of steps per day during weekends is 11621 steps, with a median of 10 steps 228, while during working days, the average daily steps is 10146 steps, and the median is 9 steps 742, so we can think that we exercise more during weekends.
Trend analysis
* Let's discuss the upward trend mentioned above. In early April, I moved from Charlotte to New York City to work as a software engineer for Yhat.
I wonder if my daily walking has changed after this move. We can use the above method of analyzing weekend and weekday walking to analyze this problem.
From the picture above, we can easily see that the amount of daily exercise has really increased since we moved to New York City. But this is determined by a variety of factors, such as the increase in the number of runs since I moved to New York City, which will increase the average number of steps per day. If we want to carry out more in-depth analysis, we need to get more data support, due to the lack of space, we will continue to analyze in later articles.
The above is the analysis of iPhone walking data shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.