1593518880

Time series data are the dataset that has been collected in a regular or constant time intervals. Time series data are used to follow a long term forecast, observe a time-dependent trend or a seasonality trend. This is very useful and commonly used in financial institutes, retail businesses, real estate, and many other types of businesses. But what about you have the data but the dates are not recorded. What if you need to use last year’s data this year to generate an experimental report? Or, you may need to use last quarter’s data in this quarter. Sometimes it is required for research, analysis, or forecasting purpose. But this year’s or this quarter’s holidays and weekends will be different.

In this article, I will explain,

- How to generate a series of dates/times
- Using the holiday calendar
- Making custom holiday calendar
- Incorporating the time series in a dataset

Luckily Pandas has a function named date-range to generate a series of dates or times. We will see how we can use it to solve some problems that we may encounter at work. Here, we will solve a few questions.

- Let’s start with the most simple one. Generate a series of dates with the frequency of a day.

```
import pandas as pd
pd.date_range(start = '1/1/2020', end='1/15/2020')
#Output:
DatetimeIndex(['2020-01-01', '2020-01-02', '2020-01-03', '2020-01-04', '2020-01-05', '2020-01-06', '2020-01-07', '2020-01-08', '2020-01-09', '2020-01-10', '2020-01-11', '2020-01-12', '2020-01-13', '2020-01-14', '2020-01-15'], dtype='datetime64[ns]', freq='D')
```

2. Generate a series of dates with an interval of two days

```
pd.date_range('1/1/2020', '1/15/2020', freq='2D')
#Output:
DatetimeIndex(['2020-01-01', '2020-01-03', '2020-01-05', '2020-01-07', '2020-01-09', '2020-01-11', '2020-01-13', '2020-01-15'], dtype='datetime64[ns]', freq='2D')
```

If you notice, we do not need to mention start and end all the time. By default, the first date is taken as the start date and the second one is taken as the end date.

#python #pandas #towards-data-science #time-series-analysis #timeseries

1616818722

In my last post, I mentioned multiple selecting and filtering in Pandas library. I will talk about time series basics with Pandas in this post. Time series data in different fields such as finance and economy is an important data structure. The measured or observed values over time are in a time series structure. Pandas is very useful for time series analysis. There are tools that we can easily analyze.

In this article, I will explain the following topics.

- What is the time series?
- What are time series data structures?
- How to create a time series?
- What are the important methods used in time series?

Before starting the topic, our Medium page includes posts on data science, artificial intelligence, machine learning, and deep learning. Please don’t forget to follow us on ** Medium** 🌱 to see these posts and the latest posts.

Let’s get started.

#what-is-time-series #pandas #time-series-python #timeseries #time-series-data

1616832900

In the last post, I talked about working with time series . In this post, I will talk about important methods in time series. Time series analysis is very frequently used in finance studies. Pandas is a very important library for time series analysis studies.

In summary, I will explain the following topics in this lesson,

- Resampling
- Shifting
- Moving Window Functions
- Time zone

Before starting the topic, our Medium page includes posts on data science, artificial intelligence, machine learning, and deep learning. Please don’t forget to follow us on ** Medium** 🌱 to see these posts and the latest posts.

Let’s get started.

#pandas-time-series #timeseries #time-series-python #time-series-analysis

1593518880

Time series data are the dataset that has been collected in a regular or constant time intervals. Time series data are used to follow a long term forecast, observe a time-dependent trend or a seasonality trend. This is very useful and commonly used in financial institutes, retail businesses, real estate, and many other types of businesses. But what about you have the data but the dates are not recorded. What if you need to use last year’s data this year to generate an experimental report? Or, you may need to use last quarter’s data in this quarter. Sometimes it is required for research, analysis, or forecasting purpose. But this year’s or this quarter’s holidays and weekends will be different.

In this article, I will explain,

- How to generate a series of dates/times
- Using the holiday calendar
- Making custom holiday calendar
- Incorporating the time series in a dataset

Luckily Pandas has a function named date-range to generate a series of dates or times. We will see how we can use it to solve some problems that we may encounter at work. Here, we will solve a few questions.

- Let’s start with the most simple one. Generate a series of dates with the frequency of a day.

```
import pandas as pd
pd.date_range(start = '1/1/2020', end='1/15/2020')
#Output:
DatetimeIndex(['2020-01-01', '2020-01-02', '2020-01-03', '2020-01-04', '2020-01-05', '2020-01-06', '2020-01-07', '2020-01-08', '2020-01-09', '2020-01-10', '2020-01-11', '2020-01-12', '2020-01-13', '2020-01-14', '2020-01-15'], dtype='datetime64[ns]', freq='D')
```

2. Generate a series of dates with an interval of two days

```
pd.date_range('1/1/2020', '1/15/2020', freq='2D')
#Output:
DatetimeIndex(['2020-01-01', '2020-01-03', '2020-01-05', '2020-01-07', '2020-01-09', '2020-01-11', '2020-01-13', '2020-01-15'], dtype='datetime64[ns]', freq='2D')
```

If you notice, we do not need to mention start and end all the time. By default, the first date is taken as the start date and the second one is taken as the end date.

#python #pandas #towards-data-science #time-series-analysis #timeseries

1623578700

In time-series data analysis, generating dates could be necessary on many occasions in real life. Sometimes we have data but time is not recorded, sometimes we may have to use one countries data for another country’s research or last year’s data this year. The holidays will be different this year than last or this country than another country. This article shows:

a. how to use the in-built holiday calendar.

b. generate a custom holiday calendar.

c. incorporate a series of dates in a dataset.

#machine-learning #technology #artificial-intelligence #programming #data-science #how to generate time series considering holidays of any country in pandas

1591688078

Dealing with dates and times in Python can be a hassle. Thankfully, there’s a built-in way of making it easier: the Python datetime module.

datetime helps us identify and process time-related elements like dates, hours, minutes, seconds, days of the week, months, years, etc. It offers various services like managing time zones and daylight savings time. It can work with timestamp data. It can extract the day of the week, day of the month, and other date and time formats from strings.

#data science tutorials #calendar #date #dates #datetime #intermediate #python #time #time series #times #tutorial #tutorials