I am new to this stuff. I need help please

Sort:
My_Chemica1_Cha0s

I want to make a Python program that makes a graph for members per day using this API: https://api.chess.com/pub/club/the-golden-64-squares/members. How can I do this?

dev_the_pro

Ask @2Kf21-0 ig

My_Chemica1_Cha0s
son_of_the_bongcloud wrote:

Ask @2Kf21-0 ig

He's offline. 

Tricky_Dicky

Load the output into a spreadsheet maybe

RAD_Financials
Tricky_Dicky wrote:

Load the output into a spreadsheet maybe

 

Excel - seems the default choice, but a bit dated(IMHO)

MS PowerBI might be more en vogue

RAD_Financials
My_Chemica1_Cha0s wrote:

I want to make a Python program that makes a graph for members per day using this API: https://api.chess.com/pub/club/the-golden-64-squares/members. How can I do this?

 

I am not an expert in this, but from I can see Matplotlib can do this is accepts JSON as a data source for graphing

I will try an work out a proof of  concept solution for you

RAD_Financials

Does anyone here know how to convert the date(above API) to a human-readable format, e.g yyyy-mm-?

Tricky_Dicky

All time fields are expressed as "timestamp", which is a number calculated as the time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). All programming languages have functions to convert timestamps to an human-readable format, but if you want to try by hand you can use one of the many online converters.

stephen_33
RAD_Financials wrote:

Does anyone here know how to convert the date(above API) to a human-readable format, e.g yyyy-mm-?

Since the OP intends working in Python, I'll answer for that..

>>> import time
>>> time.ctime(1609681855)  # 1609681855 is the current time as a utc integer
# returns the following:-

Sun Jan 3 13:50:55 2021  # that's in string form


You may find it easier to work with the date-time object:

>>> time.gmtime(1609681855)
# returns the following:-

time.struct_time(tm_year=2021, tm_mon=1, tm_mday=3, tm_hour=13, tm_min=50, tm_sec=55, tm_wday=6, tm_yday=3, tm_isdst=0)

>>> time.gmtime(1609681855).tm_year
2021

>>> time.gmtime(1609681855).tm_mon
1
# i.e. January

>>> time.gmtime(1609681855).tm_mday
3

RAD_Financials
stephen_33 wrote:
RAD_Financials wrote:

Does anyone here know how to convert the date(above API) to a human-readable format, e.g yyyy-mm-?

Since the OP intends working in Python, I'll answer for that..

>>> import time
>>> time.ctime(1609681855)  # 1609681855 is the current time as a utc integer
# returns the following:-

Sun Jan 3 13:50:55 2021  # that's in string form


You may find it easier to work with the date-time object:

>>> time.gmtime(1609681855)
# returns the following:-

time.struct_time(tm_year=2021, tm_mon=1, tm_mday=3, tm_hour=13, tm_min=50, tm_sec=55, tm_wday=6, tm_yday=3, tm_isdst=0)

>>> time.gmtime(1609681855).tm_year
2021

>>> time.gmtime(1609681855).tm_mon
1
# i.e. January

>>> time.gmtime(1609681855).tm_mday
3

 

 

Thanks - I will try it out

RAD_Financials
Tricky_Dicky wrote:

All time fields are expressed as "timestamp", which is a number calculated as the time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). All programming languages have functions to convert timestamps to an human-readable format, but if you want to try by hand you can use one of the many online converters.

OK. Will check out the online converter

 

stephen_33

In fact Python also has a time formatting method which you'll probably find more convenient:-

>>> time.strftime((""%d/%m/%Y %H:%M:%S""), time.gmtime())  # gmtime accepts any valid time integer as an argument. The default is current time

returns:
'03/01/2021 14:24:47'

You cn modify the formatting string to suit your reqirements. For example, the current day, month & year given in dd mm yyyy format s used in the UK would be:-

>>> time.strftime(("%d/%m/%Y"), time.gmtime())
'03/01/2021'

# but I wanted to space out the fields so...

>>> time.strftime(("%d %m %Y"), time.gmtime())
'03 01 2021'

* Almost forgot - you can specify the abbreviated month name instead:-

>>> time.strftime(("%d/%b/%Y %H:%M:%S"))
'03/Jan/2021 14:39:25'

# if you don't want the leading '0':-

>>> time.strftime(("%d/%b/%Y %H:%M:%S")).lstrip('0')
'3/Jan/2021 14:43:25'
etc..

The time module is well worth reading up on but I dare say you're smart enough to work out how to format any time to your own tastes.  😊

RAD_Financials
stephen_33 wrote:

In fact Python also has a time formatting method which you'll probably find more convenient:-

>>> time.strftime((""%d/%m/%Y %H:%M:%S""), time.gmtime())  # gmtime accepts any valid time integer as an argument. The default is current time

returns:
'03/01/2021 14:24:47'

You cn modify the formatting string to suit your reqirements. For example, the current day, month & year given in dd mm yyyy format s used in the UK would be:-

>>> time.strftime(("%d/%m/%Y"), time.gmtime())
'03/01/2021'

# but I wanted to space out the fields so...

>>> time.strftime(("%d %m %Y"), time.gmtime())
'03 01 2021'

* Almost forgot - you can specify the abbreviated month name instead:-

>>> time.strftime(("%d/%b/%Y %H:%M:%S"))
'03/Jan/2021 14:39:25'

# if you don't want the leading '0':-

>>> time.strftime(("%d/%b/%Y %H:%M:%S")).strip('0')
'3/Jan/2021 14:43:25'
etc..

The time module is well worth reading up on but I dare say you're smart enough to work out how to format any time to your own tastes.  😊

 

 

LOL: "The time module is well worth reading up on but I dare say you're smart enough to work out how to format any time to your own tastes.  😊"

 

Thanks for the compliment.

 

I am currently trying to work out a way in MongoDB to convert the intege date type into the "Human Readable" date format as above.

 

From internet search and MongoDB documentation, Stackoverflow, etc) I cam across MapReduce and an update function.

https://stackoverflow.com/questions/19755675/how-to-change-type-of-a-field-in-mongodb

So basically my quest is how do I convert, en mass , a player's date(integer data type) to a date data type either in Python or MongoDB.

Any help would be greatly appreciated.

TIA

stephen_33
RAD_Financials wrote:

I am currently trying to work out a way in MongoDB to convert the intege date type into the "Human Readable" date format as above.

From internet search and MongoDB documentation, Stackoverflow, etc) I cam across MapReduce and an update function.

https://stackoverflow.com/questions/19755675/how-to-change-type-of-a-field-in-mongodb

So basically my quest is how do I convert, en mass , a player's date(integer data type) to a date data type either in Python or MongoDB.

Any help would be greatly appreciated.

TIA

That I can't help with because I don't know the first thing about MongoDB.

RAD_Financials
stephen_33 wrote:
RAD_Financials wrote:

I am currently trying to work out a way in MongoDB to convert the intege date type into the "Human Readable" date format as above.

From internet search and MongoDB documentation, Stackoverflow, etc) I cam across MapReduce and an update function.

https://stackoverflow.com/questions/19755675/how-to-change-type-of-a-field-in-mongodb

So basically my quest is how do I convert, en mass , a player's date(integer data type) to a date data type either in Python or MongoDB.

Any help would be greatly appreciated.

TIA

That I can't help with because I don't know the first thing about MongoDB.

OK, No worries.The reference material I came across seems fairly straightforward  so hopefully it's just grunt work from here on

Bobcat

         l tried to stay away but it did not help so now l'm back with little less than what was there before.Wishing help makes no cense so by the sent we will go to tomorrow is another day another ayWay to say by by two day.Thank you for trying your shoe?

              From my house to your HOTEL