tndr2csv
#!/usr/bin/jq -rf .Usage as $u | $u | keys as $k | (["date"] + $k | @csv), (.[$k[0]] | keys | map(.as $d | [.] + ($k | map($u[.][$d])) | @csv))[]
Run it like this:
$ chmod + x tndr2csv
$. / tndr2csv data.json
This outputs:
"date", "app_opens", "matches", "messages_received", "messages_sent", "swipes_likes", "swipes_passes"
"2018-06-03", 3, 3, 30, 7, 30, 56
"2018-06-04", 10, 1, 1, 9, 4, 1 "2018-06-05", 2, 7, 20, 0, 4, 8
Here is an easy-to-read and robust jq program that does the job:
["date", "messages_sent", "matches", "messages_received", "swipes_passes", "swipes_likes", "app_opens"] as $keys
|
.Usage |
([.[] | keys_unsorted] | add | unique) as $dates |
$keys,
($dates[] as $d | [$d] + [.[$keys[1: ][]][$d]]) |
@csv
This Python code will do the job:
from __future__ import print_function import json import itertools # load json into an object with open('data.json') as f: d = json.load(f) usage = d['Usage'] # get all listed dates dates = sorted(set(itertools.chain.from_iterable([ [day for day in usage[t] ] for t in usage ]))) # pivot data into one row per date with multiple columns print(','.join(['date'] + [t for t in usage ])) for day in dates: print(','.join([day] + [str(usage[t][day]) for t in usage]))
This will transform the usage data in the json file into a csv that will look like:
date, messages_sent, matches, messages_received, swipes_passes, swipes_likes, app_opens 2018 - 06 - 03, 0, 2, 0, 4, 10, 2 2018 - 06 - 04, 2, 2, 1, 1, 18, 6 2018 - 06 - 05, 35, 7, 32, 1, 47, 3 2018 - 06 - 06, 16, 1, 9, 4, 32, 2
Tinder allows you to export your data anycodings_tinder (https://account.gotinder.com/data), which anycodings_tinder ends up exporting a data.json file.,To impress your date you obviously need anycodings_export-to-csv something more hackish than Python. jq anycodings_export-to-csv is a good choice since the input format anycodings_export-to-csv is json:,This will transform the usage data in anycodings_export-to-csv the json file into a csv that will look anycodings_export-to-csv like:,A full json with the interesting data would anycodings_tinder look like:
The file looks something like this:
$ cat data.json | jq.Usage {
"app_opens": {
"2018-06-03": 3,
"2018-06-04": 10,
"2018-06-05": 2,
...
With usage for:
messages_sent matches messages_received swipes_passes swipes_likes app_opens
A full json with the interesting data would anycodings_tinder look like:
{
"Usage": {
"app_opens": {
"2018-06-03": 3,
"2018-06-04": 10,
"2018-06-05": 2
},
"messages_sent": {
"2018-06-03": 7,
"2018-06-04": 9,
"2018-06-05": 0
},
"matches": {
"2018-06-03": 3,
"2018-06-04": 1,
"2018-06-05": 7
},
"messages_received": {
"2018-06-03": 30,
"2018-06-04": 1,
"2018-06-05": 20
},
"swipes_passes": {
"2018-06-03": 56,
"2018-06-04": 1,
"2018-06-05": 8
},
"swipes_likes": {
"2018-06-03": 30,
"2018-06-04": 4,
"2018-06-05": 4
}
}
}
tndr2csv
#!/usr/bin/jq -rf .Usage as $u | $u | keys as $k | (["date"] + $k | @csv), (.[$k[0]] | keys | map(.as $d | [.] + ($k | map($u[.][$d])) | @csv))[]
Run it like this:
$ chmod + x tndr2csv
$. / tndr2csv data.json
This outputs:
"date", "app_opens", "matches", "messages_received", "messages_sent", "swipes_likes", "swipes_passes"
"2018-06-03", 3, 3, 30, 7, 30, 56
"2018-06-04", 10, 1, 1, 9, 4, 1 "2018-06-05", 2, 7, 20, 0, 4, 8
Here is an easy-to-read and robust jq anycodings_export-to-csv program that does the job:
["date", "messages_sent", "matches", "messages_received", "swipes_passes", "swipes_likes", "app_opens"] as $keys
|
.Usage |
([.[] | keys_unsorted] | add | unique) as $dates |
$keys,
($dates[] as $d | [$d] + [.[$keys[1: ][]][$d]]) |
@csv
This Python code will do the job:
from __future__ import print_function import json import itertools # load json into an object with open('data.json') as f: d = json.load(f) usage = d['Usage'] # get all listed dates dates = sorted(set(itertools.chain.from_iterable([ [day for day in usage[t] ] for t in usage ]))) # pivot data into one row per date with multiple columns print(','.join(['date'] + [t for t in usage ])) for day in dates: print(','.join([day] + [str(usage[t][day]) for t in usage]))
This will transform the usage data in anycodings_export-to-csv the json file into a csv that will look anycodings_export-to-csv like:
date, messages_sent, matches, messages_received, swipes_passes, swipes_likes, app_opens 2018 - 06 - 03, 0, 2, 0, 4, 10, 2 2018 - 06 - 04, 2, 2, 1, 1, 18, 6 2018 - 06 - 05, 35, 7, 32, 1, 47, 3 2018 - 06 - 06, 16, 1, 9, 4, 32, 2
If you download your Tinder data as instructed, you will receive a zipped file. In that file, there is a JSON labeled “data.JSON”. This is your Tinder data - namely, all your messages and daily statistics.,If you extract and copy data.JSON to your R working directory and run the code in grabyourtinder.R, you will be able to create all these graphs and statistics for yourself, and generate a .csv of your Tinder data.,I’ve made it possible for you to create all these statistics and graphs for yourself at the click of a button.,Since my Tinder data JSON file also contains my message data, it will unfortunately not be made available with this project. As you will see soon, there are a lot of messages in there, and thus a plethora of personally identifiable information (for myself and others) that can’t be posted on the internet. Hope you understand.
print(paste0('Total messages sent: ', sum(bentinder$messages_sent)))
print(paste0('Total messages sent: ', sum(bentinder$messages_sent)))
# #[1]
"Total messages sent: 23047"
print(paste0('Total messages received: ', sum(bentinder$messages_received)))
print(paste0('Total messages: ', sum(bentinder$messages_sent) + sum(bentinder$messages_received)))
# #[1]
"Total messages: 42203"
print(paste0('Total messages received: ', sum(bentinder$messages_received)))
print(paste0('Total messages: ', sum(bentinder$messages_sent) + sum(bentinder$messages_received)))
messages = bentinder % > % select(date, messages_sent, messages_received) % > % mutate(message_differential = messages_received - messages_sent) bentinder = bentinder % > % mutate(messages = messages_sent + messages_received) % > % select(-c(messages_sent, messages_received)) bentinder = bentinder % > % mutate(swipes = likes + passes) sapply(bentinder[-1], sum)
sapply(bentinder[-1], max)