<commit_before>require 'nyaplot'
require 'securerandom'
require 'json'
require 'csv'

module Nyaplot
  begin
    require "mikon"
  rescue
  end

  if defined? Mikon
    class DataFrame
      include Nyaplot::Base
      type :data
      required_args :data

      def initialize(*args)
        super()
        if args.length == 1 && args.first.is_a?(Mikon::DataFrame)
          @df = args.first
        else
          @df = Mikon::DataFrame.new(*args)
        end
        data(@df)
      end

      def to_html
        @df.to_html
      end

      def method_missing(name, *args, &block)
        if @df.respond_to? name
          ret = @df.send(name, *args, &block)
          if ret.is_a?(Mikon::DataFrame)
            self.class.new(ret)
          else<commit_msg>Implement Nyaplot::DataFrame#select!<commit_after>require 'nyaplot'
require 'securerandom'
require 'json'
require 'csv'

module Nyaplot
  begin
    require "mikon"
  rescue
  end

  if defined? Mikon
    class DataFrame
      include Nyaplot::Base
      type :data
      required_args :data

      def initialize(*args)
        super()
        if args.length == 1 && args.first.is_a?(Mikon::DataFrame)
          @df = args.first
        else
          @df = Mikon::DataFrame.new(*args)
        end
        data(@df)
      end

      def select!(*args, &block)
        @df = @df.select(*args, &block)
        data(@df)
        self
      end

      def to_html
        @df.to_html
      end

      def method_missing(name, *args, &block)
        if @df.respond_to? name
          ret = @df.send(name, *args, &block)
          if ret.is_a?(Mikon::DataFrame)
            self.class.new(ret)
          else
{'fraction_non_alphanumeric': 0.10804321728691477, 'fraction_numerical': 0.0012004801920768306, 'mean_word_length': 1.9041811846689896, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2598546', 'n_tokens_mistral': 557, 'n_tokens_neox': 548, 'n_words': 129}