You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/remote_data.rst
-60
Original file line number
Diff line number
Diff line change
@@ -29,63 +29,3 @@ modules to be independently updated to your pandas installation. The API for
29
29
.. code-block:: python
30
30
31
31
from pandas_datareader import data, wb
32
-
33
-
34
-
.. _remote_data.ga:
35
-
36
-
Google Analytics
37
-
----------------
38
-
39
-
The :mod:`~pandas.io.ga` module provides a wrapper for
40
-
`Google Analytics API <https://developers.google.com/analytics/devguides>`__
41
-
to simplify retrieving traffic data.
42
-
Result sets are parsed into a pandas DataFrame with a shape and data types
43
-
derived from the source table.
44
-
45
-
Configuring Access to Google Analytics
46
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47
-
48
-
The first thing you need to do is to setup accesses to Google Analytics API. Follow the steps below:
49
-
50
-
#. In the `Google Developers Console <https://console.developers.google.com>`__
51
-
#. enable the Analytics API
52
-
#. create a new project
53
-
#. create a new Client ID for an "Installed Application" (in the "APIs & auth / Credentials section" of the newly created project)
54
-
#. download it (JSON file)
55
-
#. On your machine
56
-
#. rename it to ``client_secrets.json``
57
-
#. move it to the ``pandas/io`` module directory
58
-
59
-
The first time you use the :func:`read_ga` function, a browser window will open to ask you to authentify to the Google API. Do proceed.
60
-
61
-
Using the Google Analytics API
62
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63
-
64
-
The following will fetch users and pageviews (metrics) data per day of the week, for the first semester of 2014, from a particular property.
65
-
66
-
.. code-block:: python
67
-
68
-
import pandas.io.ga as ga
69
-
ga.read_ga(
70
-
account_id="2360420",
71
-
profile_id="19462946",
72
-
property_id="UA-2360420-5",
73
-
metrics= ['users', 'pageviews'],
74
-
dimensions= ['dayOfWeek'],
75
-
start_date="2014-01-01",
76
-
end_date="2014-08-01",
77
-
index_col=0,
78
-
filters="pagePath=~aboutus;ga:country==France",
79
-
)
80
-
81
-
The only mandatory arguments are ``metrics,`` ``dimensions`` and ``start_date``. We strongly recommend that you always specify the ``account_id``, ``profile_id`` and ``property_id`` to avoid accessing the wrong data bucket in Google Analytics.
82
-
83
-
The ``index_col`` argument indicates which dimension(s) has to be taken as index.
84
-
85
-
The ``filters`` argument indicates the filtering to apply to the query. In the above example, the page URL has to contain ``aboutus`` AND the visitors country has to be France.
86
-
87
-
Detailed information in the following:
88
-
89
-
* `pandas & google analytics, by yhat <http://blog.yhathq.com/posts/pandas-google-analytics.html>`__
90
-
* `Google Analytics integration in pandas, by Chang She <http://quantabee.wordpress.com/2012/12/17/google-analytics-pandas/>`__
91
-
* `Google Analytics Dimensions and Metrics Reference <https://developers.google.com/analytics/devguides/reporting/core/dimsmets>`_
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.15.2.txt
+1-1
Original file line number
Diff line number
Diff line change
@@ -163,7 +163,7 @@ Other enhancements:
163
163
p.all()
164
164
165
165
- Added support for ``utcfromtimestamp()``, ``fromtimestamp()``, and ``combine()`` on `Timestamp` class (:issue:`5351`).
166
-
- Added Google Analytics (`pandas.io.ga`) basic documentation (:issue:`8835`). See :ref:`here<remote_data.ga>`.
166
+
- Added Google Analytics (`pandas.io.ga`) basic documentation (:issue:`8835`). See `here<http://pandas.pydata.org/pandas-docs/version/0.15.2/remote_data.html#remote-data-ga>`__.
167
167
- ``Timedelta`` arithmetic returns ``NotImplemented`` in unknown cases, allowing extensions by custom classes (:issue:`8813`).
168
168
- ``Timedelta`` now supports arithemtic with ``numpy.ndarray`` objects of the appropriate dtype (numpy 1.8 or newer only) (:issue:`8884`).
169
169
- Added ``Timedelta.to_timedelta64()`` method to the public API (:issue:`8884`).
0 commit comments