Primary competition visual

RMB Monthly Mini Challenge #1: Nowcast April

Helping South Africa
$600 USD
Completed (almost 3 years ago)
Forecast
592 joined
132 active
Starti
Mar 21, 23
Closei
May 01, 23
Reveali
May 24, 23
User avatar
ihar
Adolf Würth GmbH & Co. KG
Month in "Naamsa_Vehicle_Sales.csv" and "PayProp_Rental_Index.csv"
Data Ā· 22 Mar 2023, 14:30 Ā· 8

Does anybody know how to convert "Month" column in "Naamsa_Vehicle_Sales.csv" and "PayProp_Rental_Index.csv" to normal representation?

This column has values like this: 45282, 45252, 45221...

Discussion 8 answers
User avatar
zreal135
University of Medical Sciences Ondo

What programming language are you using? R or Python?

22 Mar 2023, 15:01
Upvotes 0
User avatar
ihar
Adolf Würth GmbH & Co. KG

Python

check converting timestamp into dates

22 Mar 2023, 18:31
Upvotes 0
User avatar
Jaw22
Zindi africa

Try using this code:

import pandas as pd

# Load the CSV file

df = pd.read_csv("Naamsa_Vehicle_Sales.csv")

# Convert the "Month" column to a date format

df["Month"] = pd.to_datetime(df["Month"])

# Extract the year and month information and create new columns

df["Year"] = df["Month"].dt.year

df["Month_Number"] = df["Month"].dt.month

# Optionally, drop the original "Month" column

df = df.drop("Month", axis=1)

# Display the resulting dataframe

print(df.head())

Hope it helps...

22 Mar 2023, 20:55
Upvotes 0
User avatar
ihar
Adolf Würth GmbH & Co. KG

It's not a timestamp. It's too short. For example, the conversion of the value 45282 with `pd.to_datetime` gives 1970-01-01 00:00:00.000045282

22 Mar 2023, 21:06
Upvotes 0
User avatar
ihar
Adolf Würth GmbH & Co. KG

It looks like a number of days after some defined date.

Hello, there should be a new notebook uploaded today to fix this issue of the naamsa data. You can use the same logic for the latter.

23 Mar 2023, 07:45
Upvotes 1
User avatar
zreal135
University of Medical Sciences Ondo

I will check it out and get back to you. But if you have done it let me know

23 Mar 2023, 08:48
Upvotes 0