Loading the toolbox
The Pici
class from the pici
package gives access to all functionality related to loading and analyzing peer innovation communities.
In [ ]:
Copied!
from pici import Pici
from pici import Pici
Instantiating the Pici
class will set up all communities currently available in the library.
- When defining a
cache_dir
directory, pici will try to load all data from files instead of collecting new data from the web. - You can limit the loaded data by setting the
start
and/orend
parameters, passing, for example '2017' or '2017-01' or '2017-01-25' etc. - When using the cache, you can further limit loaded data with the
cache_nrows
parameter. For example, settingcache_nrwos=500
would only load the first 500 rows of the cache.
In [3]:
Copied!
p = Pici(
cache_dir='../../cache',
cache_nrows=1000,
# start='2017-01-01',
# end='2019-01-01',
)
p = Pici(
cache_dir='../../cache',
cache_nrows=1000,
# start='2017-01-01',
# end='2019-01-01',
)
This has loaded three communities:
In [4]:
Copied!
p.communities
p.communities
Out[4]:
{'OpenEnergyMonitor': <pici.communities.discourse.DiscourseCommunity at 0x2a7ab126d60>, 'OpenStreetMap': <pici.communities.osm.OSMCommunity at 0x2a7c2999c10>, 'PreciousPlastic': <pici.communities.preciousplastic.PPCommunity at 0x2a7c2999400>}
You can now access the communities individually:
In [5]:
Copied!
osm = p.communities['OpenStreetMap']
osm = p.communities['OpenStreetMap']
In [6]:
Copied!
contributors_per_month = osm.metrics.contributors_per_interval(interval='1M').data
contributors_per_month = osm.metrics.contributors_per_interval(interval='1M').data
Or generate reports for all communities collectively:
In [8]:
Copied!
summary = p.reports.summary()
summary = p.reports.summary()
In [9]:
Copied!
summary.results.T
summary.results.T
Out[9]:
community_name | OpenEnergyMonitor | OpenStreetMap | PreciousPlastic |
---|---|---|---|
sum posts per topic | 1000.000000 | 1000.000000 | 1000.000000 |
min posts per topic | 14.000000 | 1.000000 | 1.000000 |
mean posts per topic | 58.823529 | 3.690037 | 10.869565 |
number of posts | 1000.000000 | 1000.000000 | 1000.000000 |
var number of posts per 1M | 432.467030 | 71.450564 | 186.734177 |
std number of posts per 1d | 1.936793 | 0.773700 | 1.321718 |
var number of posts per 1d | 3.751166 | 0.598612 | 1.746939 |
sum number of posts per 1d | 1000.000000 | 1000.000000 | 1000.000000 |
sum number of posts per 1M | 1000.000000 | 1000.000000 | 1000.000000 |
min number of posts per 1M | 0.000000 | 0.000000 | 0.000000 |
mean number of posts per 1M | 17.241379 | 5.813953 | 12.500000 |
std posts per topic | 45.913281 | 2.613330 | 20.679244 |
max number of posts per 1M | 102.000000 | 38.000000 | 76.000000 |
max posts per topic | 176.000000 | 21.000000 | 122.000000 |
min number of posts per 1d | 0.000000 | 0.000000 | 0.000000 |
var posts per topic | 2108.029412 | 6.829493 | 427.631151 |
mean number of posts per 1d | 0.582751 | 0.192604 | 0.416840 |
max number of posts per 1d | 43.000000 | 12.000000 | 19.000000 |
std number of posts per 1M | 20.795842 | 8.452844 | 13.665071 |