[datetime]S7_02_Timestamp
https://pandas.pydata.org/docs/reference/api/pandas.Timestamp.html In [31]: import pandas as pd import datetime as dt In [33]: pd.Timestamp('2023, 3, 30') Out[33]: Timestamp('2023-03-30 00:00:00') In [34]: # Pandas Timestamp pd.Timestamp(dt.datetime(2022, 3, 31, 8, 0, 15,)) Out[34]: Timestamp('2022-03-31 08:00:15') In [35]: # Difference between two dates day_1 = pd.Timestamp('1990, 3, 31, 11') d..
2023. 1. 21.
[datetime]S7_01_datetime
In [11]: # date: define dates only without including time (month, day, year) # datetime : define times and dates together (month, day, year, hour, second, microsecond) import pandas as pd import datetime as dt In [12]: # A date date_ex = dt.date(2022,1,1) date_ex Out[12]: datetime.date(2022, 1, 1) In [13]: type(date_ex) Out[13]: datetime.date In [14]: # Convert it into string to view str(now) Ou..
2023. 1. 21.
[matplotlib]S5_06_pie_chart
In [1]: import matplotlib.pyplot as plt import pandas as pd import datetime In [2]: # data crypto_dict = {'allocation': [20,55,5,17,3]} explode = (0,0,0,0.2,0) In [3]: crypto_df = pd.DataFrame(data= crypto_dict, index=['BTC','ETH','LTC','XRP','ADA']) crypto_df Out[3]: allocation BTC 20 ETH 55 LTC 5 XRP 17 ADA 3 In [4]: # a pie chart crypto_df.plot.pie(y = 'allocation',explode = explode, figsize ..
2023. 1. 21.