Комментарии:
Hope you all are all staying safe! In this video we'll be learning a lot about working with dates and time-series data in Pandas, and also look at doing some basic plotting. In the next video, we'll be learning how to load in data to Pandas from different (Excel, JSON, SQL, etc). Let me know if there is anything else you'd like me to cover in the Pandas series. I will likely be taking a break from this series after the next two videos are released just so I can focus on some different topics.
ОтветитьI used this video to backtrack over some material that I wasn't sure of. This was a great video as is your other instructional videos. Thanks so much.
ОтветитьFor those getting an error for accessing the datetime index, you need to sort it first now. So instead of df['2020'] make it df.sort_index()['2020'] and the same for slicing it
Ответитьdf ['2019'] doesn't work for me. It gives me an error = '2019'. my 'Date' column is of data type datetime64[ns]. It also gives error in df ['2020-01-01']
ОтветитьI got an error with the lambda function trying to parse the dates while loading from csv. The error stated pandas no longer supports pd.datetime. After checking the comments I tried @larc99's suggestion but still got an error as it was expecting a string rather than a function for the format. What gave the same output and I think is much simpler (without the lambda function) turned out to be:
df = pd.read_csv('data/ETH_1h.csv', parse_dates=['Date'], date_format='%Y-%m-%d %I-%p')
To anyone getting the message that 'date_parser' is deprecated and will be removed in a future version...
You no longer need to pass in a function, just the date string formats in the argument date_format='%Y-%m-%d %I-%p'
example:
df = pd.read_csv('ETH_1h.csv', parse_dates=['Date'], date_format='%Y-%m-%d %I-%p')
TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex.
For those getting this error. Set the index of the dataframe to date.
For datetime error: Just use below
df = pd.read_csv('data/ETH_1h.csv', parse_dates=['Date'], date_format='%Y-%m-%d %I-%p')
```
import pandas as pd
from datetime import datetime
```
```
df = pd.read_csv('ETH_1h.csv', parse_dates=['Date'], date_format='%Y-%m-%d %I-%p')
```
```
df.head()
```
this is the new version of the code in 2023
Did he create the series on plotting with Pandas ?
Ответить@coreyms can you please give us the download link for ETH_1h.csv
ОтветитьExtremely useful. Thanks for the video Corey! You have my gratitude.
ОтветитьYou used %I instead of %H, but the output displayed is in the format determined by %H (24 hour clock). Why is that?
Ответитьdf = pd.read_csv('ETH.csv', parse_dates=['Date'], date_format="%Y-%m-%d %I-%p")
ОтветитьI learn through this video in 2023 as a new entry-level data analyst and non-native English. It's still relevant and lite but packed, especially for the `.resample()` method. It saves my time compared to using `.groupby()`. In addition, we need to keep in mind indice filtering. It's better to use `.loc[]` to avoid the deprecation issue. Thank you, Corey Schafer. Your channel is such a gem!
ОтветитьHello. Where can I download the 'ETH_1h.csv' file?
ОтветитьWhere is required dataframe for this video bro!
Ответитьinstead of using df.set_index('Date' , inplace=True) you can also use
df=df.set_index('Date') cause in future inplace attribute will be deprecated