diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 6ebf3be..06441ce 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -6,7 +6,8 @@ Improvements:
 * Add a :code:`--version` (:code:`-V`) flag.
 * :code:`-I` is the short option for :code:`--no-inference`.
 * :doc:`/scripts/csvjoin` supports :code:`--snifflimit` and :code:`--no-inference`.
-* :doc:`/scripts/in2csv` now supports a :code:`--names` flag to print Excel sheet names.
+* :doc:`/scripts/csvstat` adds a :code:`--freq-count` option to set the maximum number of frequent values to display.
+* :doc:`/scripts/in2csv` adds a :code:`--names` flag to print Excel sheet names.
 
 Fixes:
 
diff --git a/csvkit/utilities/csvstat.py b/csvkit/utilities/csvstat.py
index 2292e77..29908d2 100644
--- a/csvkit/utilities/csvstat.py
+++ b/csvkit/utilities/csvstat.py
@@ -13,9 +13,6 @@ from csvkit.cli import CSVKitUtility, parse_column_identifiers
 
 NoneType = type(None)
 
-MAX_UNIQUE = 5
-MAX_FREQ = 5
-
 OPERATIONS = OrderedDict([
     ('type', {
         'aggregation': None,
@@ -97,8 +94,10 @@ class CSVStat(CSVKitUtility):
                                     help='Only output the length of the longest values.')
         self.argparser.add_argument('--freq', dest='freq_only', action='store_true',
                                     help='Only output lists of frequent values.')
+        self.argparser.add_argument('--freq-count', dest='freq_count', type=int,
+                                    help='The maximum number of frequent values to display.')
         self.argparser.add_argument('--count', dest='count_only', action='store_true',
-                                    help='Only output total row count')
+                                    help='Only output total row count.')
         self.argparser.add_argument('-y', '--snifflimit', dest='sniff_limit', type=int,
                                     help='Limit CSV dialect sniffing to the specified number of bytes. Specify "0" to disable sniffing entirely.')
 
@@ -144,18 +143,23 @@ class CSVStat(CSVKitUtility):
             self.get_column_offset()
         )
 
+        kwargs = {}
+
+        if self.args.freq_count:
+            kwargs['freq_count'] = self.args.freq_count
+
         # Output a single stat
         if operations:
             if len(column_ids) == 1:
-                self.print_one(table, column_ids[0], operations[0], label=False)
+                self.print_one(table, column_ids[0], operations[0], label=False, **kwargs)
             else:
                 for column_id in column_ids:
-                    self.print_one(table, column_id, operations[0])
+                    self.print_one(table, column_id, operations[0], **kwargs)
         else:
             stats = {}
 
             for column_id in column_ids:
-                stats[column_id] = self.calculate_stats(table, column_id)
+                stats[column_id] = self.calculate_stats(table, column_id, **kwargs)
 
             # Output as CSV
             if self.args.csv_output:
@@ -164,7 +168,7 @@ class CSVStat(CSVKitUtility):
             else:
                 self.print_stats(table, column_ids, stats)
 
-    def print_one(self, table, column_id, operation, label=True):
+    def print_one(self, table, column_id, operation, label=True, **kwargs):
         """
         Print data for a single statistic.
         """
@@ -178,7 +182,7 @@ class CSVStat(CSVKitUtility):
 
             try:
                 if getter:
-                    stat = getter(table, column_id)
+                    stat = getter(table, column_id, **kwargs)
                 else:
                     op = OPERATIONS[op_name]['aggregation']
                     stat = table.aggregate(op(column_id))
@@ -198,7 +202,7 @@ class CSVStat(CSVKitUtility):
         else:
             self.output_file.write(u'%s\n' % stat)
 
-    def calculate_stats(self, table, column_id):
+    def calculate_stats(self, table, column_id, **kwargs):
         """
         Calculate stats for all valid operations.
         """
@@ -212,7 +216,7 @@ class CSVStat(CSVKitUtility):
 
                 try:
                     if getter:
-                        stats[op_name] = getter(table, column_id)
+                        stats[op_name] = getter(table, column_id, **kwargs)
                     else:
                         op = op_data['aggregation']
                         v = table.aggregate(op(column_id))
@@ -314,16 +318,16 @@ class CSVStat(CSVKitUtility):
             writer.writerow(output_row)
 
 
-def get_type(table, column_id):
+def get_type(table, column_id, **kwargs):
     return '%s' % table.columns[column_id].data_type.__class__.__name__
 
 
-def get_unique(table, column_id):
+def get_unique(table, column_id, **kwargs):
     return len(table.columns[column_id].values_distinct())
 
 
-def get_freq(table, column_id):
-    return table.pivot(column_id).order_by('Count', reverse=True).limit(MAX_FREQ)
+def get_freq(table, column_id, freq_count=5, **kwargs):
+    return table.pivot(column_id).order_by('Count', reverse=True).limit(freq_count)
 
 
 def launch_new_instance():

csvstat: flag to specify how many frequent values to display
Csvstat is really a very useful tool, but it still could be better : the "frequent values" feature is apparently fixedly limited to 5 values. It would be great if this "5" value was only the default value, and could be altered by a new parameter, say "-f ". 

For example : "csvstat -f 20 -c 3,7 --freq myfile.csv" would return the 20 most frequent values of colums 3 and 7. Today it (seems) impossible to exceed the limit of 5 values.

Best regards, thanks for this great kit.

diff --git a/tests/test_utilities/test_csvstat.py b/tests/test_utilities/test_csvstat.py
index 2f9cec2..875c7dd 100644
--- a/tests/test_utilities/test_csvstat.py
+++ b/tests/test_utilities/test_csvstat.py
@@ -55,6 +55,14 @@ class TestCSVStat(CSVKitTestCase, ColumnsTests, EmptyFileTests, NamesTests):
         self.assertIn('SALINE (59x)', output)
         self.assertNotIn('MIAMI (56x)', output)
 
+
+    def test_freq_count(self):
+        output = self.get_output(['examples/realdata/ks_1033_data.csv', '--freq-count', '1'])
+
+        self.assertIn('WYANDOTTE (123x)', output)
+        self.assertNotIn('SALINE (59x)', output)
+        self.assertNotIn('MIAMI (56x)', output)
+
     def test_csv(self):
         output = self.get_output_as_io(['--csv', 'examples/realdata/ks_1033_data.csv'])
 

pip install -e .
parse_log_pytest
requirements.txt
nose pytest
3.6
requirements-py3.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
agate==1.13.0
agate-dbf==0.2.3
agate-excel==0.4.1
agate-sql==0.7.2
alabaster==0.7.13
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
-e git+https://github.com/wireservice/csvkit.git@7c26421a9f7f32318eb96b2649f62ab0192f2f33#egg=csvkit
dbfread==2.0.7
distlib==0.3.9
docutils==0.18.1
et-xmlfile==1.1.0
filelock==3.4.1
greenlet==2.0.2
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
isodate==0.6.1
Jinja2==3.0.3
leather==0.4.0
MarkupSafe==2.0.1
nose==1.3.7
olefile==0.47
openpyxl==3.1.3
packaging==21.3
parsedatetime==2.6
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
python-slugify==6.1.2
pytimeparse==1.1.8
pytz==2025.2
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
SQLAlchemy==1.4.54
text-unidecode==1.3
toml==0.10.2
tomli==1.2.3
tox==3.28.0
typing_extensions==4.1.1
urllib3==1.26.20
virtualenv==20.17.1
xlrd==2.0.1
zipp==3.6.0

name: csvkit
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - agate==1.13.0
      - agate-dbf==0.2.3
      - agate-excel==0.4.1
      - agate-sql==0.7.2
      - alabaster==0.7.13
      - attrs==22.2.0
      - babel==2.11.0
      - charset-normalizer==2.0.12
      - coverage==6.2
      - dbfread==2.0.7
      - distlib==0.3.9
      - docutils==0.18.1
      - et-xmlfile==1.1.0
      - filelock==3.4.1
      - greenlet==2.0.2
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.8.3
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - isodate==0.6.1
      - jinja2==3.0.3
      - leather==0.4.0
      - markupsafe==2.0.1
      - nose==1.3.7
      - olefile==0.47
      - openpyxl==3.1.3
      - packaging==21.3
      - parsedatetime==2.6
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - py==1.11.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - python-slugify==6.1.2
      - pytimeparse==1.1.8
      - pytz==2025.2
      - requests==2.27.1
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==5.3.0
      - sphinx-rtd-theme==2.0.0
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jquery==4.1
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - sqlalchemy==1.4.54
      - text-unidecode==1.3
      - toml==0.10.2
      - tomli==1.2.3
      - tox==3.28.0
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - virtualenv==20.17.1
      - xlrd==2.0.1
      - zipp==3.6.0
prefix: /opt/conda/envs/csvkit

tests/test_utilities/test_csvstat.py::TestCSVStat::test_freq_count
tests/test_utilities/test_csvstat.py::TestCSVStat::test_columns tests/test_utilities/test_csvstat.py::TestCSVStat::test_count_only tests/test_utilities/test_csvstat.py::TestCSVStat::test_csv tests/test_utilities/test_csvstat.py::TestCSVStat::test_csv_columns tests/test_utilities/test_csvstat.py::TestCSVStat::test_empty tests/test_utilities/test_csvstat.py::TestCSVStat::test_encoding tests/test_utilities/test_csvstat.py::TestCSVStat::test_freq_list tests/test_utilities/test_csvstat.py::TestCSVStat::test_invalid_column tests/test_utilities/test_csvstat.py::TestCSVStat::test_invalid_options tests/test_utilities/test_csvstat.py::TestCSVStat::test_launch_new_instance tests/test_utilities/test_csvstat.py::TestCSVStat::test_max_length tests/test_utilities/test_csvstat.py::TestCSVStat::test_names tests/test_utilities/test_csvstat.py::TestCSVStat::test_no_header_row tests/test_utilities/test_csvstat.py::TestCSVStat::test_runs tests/test_utilities/test_csvstat.py::TestCSVStat::test_unique
CHANGELOG.rst csvkit/utilities/csvstat.py
CHANGELOG.rst csvkit/utilities/csvstat.py