kandi background
Explore Kits

q | Run SQL directly on delimited files | CSV Processing library

 by   harelba Python Version: latest License: GPL-3.0

 by   harelba Python Version: latest License: GPL-3.0

Download this library from

kandi X-RAY | q Summary

q is a Python library typically used in Utilities, CSV Processing applications. q has no bugs, it has no vulnerabilities, it has build file available, it has a Strong Copyleft License and it has high support. You can download it from GitHub.
q's purpose is to bring SQL expressive power to the Linux command line and to provide easy access to text as actual data.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • q has a highly active ecosystem.
  • It has 8893 star(s) with 379 fork(s). There are 172 watchers for this library.
  • There were 1 major release(s) in the last 12 months.
  • There are 78 open issues and 120 have been closed. On average issues are closed in 407 days. There are 16 open pull requests and 0 closed requests.
  • It has a negative sentiment in the developer community.
  • The latest version of q is latest
q Support
Best in #CSV Processing
Average in #CSV Processing
q Support
Best in #CSV Processing
Average in #CSV Processing

quality kandi Quality

  • q has 0 bugs and 0 code smells.
q Quality
Best in #CSV Processing
Average in #CSV Processing
q Quality
Best in #CSV Processing
Average in #CSV Processing

securitySecurity

  • q has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • q code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
q Security
Best in #CSV Processing
Average in #CSV Processing
q Security
Best in #CSV Processing
Average in #CSV Processing

license License

  • q is licensed under the GPL-3.0 License. This license is Strong Copyleft.
  • Strong Copyleft licenses enforce sharing, and you can use them when creating open source projects.
q License
Best in #CSV Processing
Average in #CSV Processing
q License
Best in #CSV Processing
Average in #CSV Processing

buildReuse

  • q releases are available to install and integrate.
  • Build file is available. You can build the component from source.
  • Installation instructions are not available. Examples and code snippets are available.
  • It has 6971 lines of code, 543 functions and 10 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
q Reuse
Best in #CSV Processing
Average in #CSV Processing
q Reuse
Best in #CSV Processing
Average in #CSV Processing
Top functions reviewed by kandi - BETA

kandi has reviewed q and discovered the below as its top functions. This is intended to give you an instant insight into q implemented functionality, and help decide if they suit your requirements.

  • Execute the pipeline
    • Closes all databases
    • Dump default values
    • Dump the default values
  • Choose the db to use
    • Calculate the content key for the given content signature
    • Execute a SQL query and return the result
    • Add entry to qcatalog table
  • Autodetect table name from qsql
    • Get all entries from qcatalog
  • Perform analysis
    • Perform the analysis
  • Create qcatalog table
    • Validate the table name in the Qsqlite3 database
      • Returns the name of the table in the Sqlite3 database
        • Unload all tables
          • Normalize qtable name
            • Validate the table name in Sqlite3
              • Quote double quotes
                • Finalize the histogram
                  • Quote non - numeric characters
                    • Creates a list of files that match the given qtable
                      • Generator that yields csv rows
                        • Choose a db to use
                          • Make the data available for the database
                            • Make the data available in the database

                              Get all kandi verified functions for this library.

                              Get all kandi verified functions for this library.

                              q Key Features

                              Performing SQL-like statements directly on tabular text data, auto-caching the data in order to accelerate additional querying on the same file.

                              Performing SQL statements directly on multi-file sqlite3 databases, without having to merge them or load them into memory

                              Usage Examples

                              copy iconCopydownload iconDownload
                              $ q "SELECT COUNT(*) FROM ./clicks_file.csv WHERE c3 > 32.3"
                              
                              $ ps -ef | q -H "SELECT UID, COUNT(*) cnt FROM - GROUP BY UID ORDER BY cnt DESC LIMIT 3"
                              
                              $ q "select count(*) from some_db.sqlite3:::albums a left join another_db.sqlite3:::tracks t on (a.album_id = t.album_id)"
                              

                              How to override a nested npm sub-dependency with a different package altogether (not just different package version number)?

                              copy iconCopydownload iconDownload
                              "resolutions": {
                                  "ansi-html": "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz"
                              }
                              
                              npm view ansi-html-community dist.tarball --registry=https://registry.npmjs.org/
                              
                                "scripts": {
                                  "preinstall": "npx npm-force-resolutions"
                                }
                              
                              "resolutions": {
                                  "ansi-html": "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz"
                              }
                              
                              npm view ansi-html-community dist.tarball --registry=https://registry.npmjs.org/
                              
                                "scripts": {
                                  "preinstall": "npx npm-force-resolutions"
                                }
                              
                              "resolutions": {
                                  "ansi-html": "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz"
                              }
                              
                              npm view ansi-html-community dist.tarball --registry=https://registry.npmjs.org/
                              
                                "scripts": {
                                  "preinstall": "npx npm-force-resolutions"
                                }
                              
                               "resolutions": {
                                  "ansi-html": "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz"
                                }

                              Google OAuth 2.0 failing with Error 400: invalid_request for some client_id, but works well for others in the same project

                              copy iconCopydownload iconDownload
                              This site can’t be reached
                              
                              The webpage at http://localhost:1/oauth2callback?
                              code=4/a3MU9MlhWxit8P7N8QsGtT0ye8GJygOeCa3MU9MlhWxit8P7N8QsGtT0y
                              e8GJygOeC&scope=email%20profile%20https... might be temporarily
                              down or it may have moved permanently to a new web address.
                              
                              ERR_UNSAFE_PORT
                              
                              
                              def user_credentials_for(scope, user_id = 'default')
                                  token_store = Google::Auth::Stores::FileTokenStore.new(:file => token_store_path)
                                  authorizer = Google::Auth::UserAuthorizer.new(client_id, scope, token_store, "http://localhost:1/")
                                  credentials = authorizer.get_credentials(user_id)
                                  if credentials.nil?
                                      url = authorizer.get_authorization_url
                                      $stderr.puts ""
                                      $stderr.puts "-----------------------------------------------"
                                      $stderr.puts "Requesting authorization for '#{user_id}'"
                                      $stderr.puts "Open the following URL in your browser and authorize the application."
                                      $stderr.puts url
                                      $stderr.puts
                                      $stderr.puts "At the end the browser will fail to connect to http://localhost:1/?code=SOMECODE&scope=..."
                                      $stderr.puts "Copy the value of SOMECODE from the address and paste it below"
                              
                                      code = $stdin.readline.chomp
                                      $stderr.puts "-----------------------------------------------"
                                      credentials = authorizer.get_and_store_credentials_from_code(
                                          user_id: user_id, code: code)
                                  end
                                  credentials
                              end                                                                                                                                      ```
                              
                              This site can’t be reached
                              
                              The webpage at http://localhost:1/oauth2callback?
                              code=4/a3MU9MlhWxit8P7N8QsGtT0ye8GJygOeCa3MU9MlhWxit8P7N8QsGtT0y
                              e8GJygOeC&scope=email%20profile%20https... might be temporarily
                              down or it may have moved permanently to a new web address.
                              
                              ERR_UNSAFE_PORT
                              
                              
                              def user_credentials_for(scope, user_id = 'default')
                                  token_store = Google::Auth::Stores::FileTokenStore.new(:file => token_store_path)
                                  authorizer = Google::Auth::UserAuthorizer.new(client_id, scope, token_store, "http://localhost:1/")
                                  credentials = authorizer.get_credentials(user_id)
                                  if credentials.nil?
                                      url = authorizer.get_authorization_url
                                      $stderr.puts ""
                                      $stderr.puts "-----------------------------------------------"
                                      $stderr.puts "Requesting authorization for '#{user_id}'"
                                      $stderr.puts "Open the following URL in your browser and authorize the application."
                                      $stderr.puts url
                                      $stderr.puts
                                      $stderr.puts "At the end the browser will fail to connect to http://localhost:1/?code=SOMECODE&scope=..."
                                      $stderr.puts "Copy the value of SOMECODE from the address and paste it below"
                              
                                      code = $stdin.readline.chomp
                                      $stderr.puts "-----------------------------------------------"
                                      credentials = authorizer.get_and_store_credentials_from_code(
                                          user_id: user_id, code: code)
                                  end
                                  credentials
                              end                                                                                                                                      ```
                              
                              
                              require 'colorize'
                              require 'sinatra/base'
                              
                              def run_local_server(authorizer, port, user_id)
                              
                                  require 'thin'
                                  Thin::Logging.silent = true
                              
                                  Thread.new {
                              
                                      Thread.current[:server] = Sinatra.new do
                              
                                          enable :quiet
                                          disable :logging
                                          set :port, port
                                          set :server, %w[ thin ]
                              
                                          get "/" do
                                              request = Rack::Request.new env
                                              state = {
                                                  code:  request["code"],
                                                  error: request["error"],
                                                  scope: request["scope"]
                                              }
                                              raise Signet::AuthorizationError, ("Authorization error: %s" % [ state[:error] ] ) if state[:error]
                                              raise Signet::AuthorizationError, "Authorization code missing from the request" if state[:code].nil?
                                              credentials = authorizer.get_and_store_credentials_from_code(
                              
                                                  user_id: user_id,
                                                  code: state[:code],
                                                  scope: state[:scope],
                                              )
                                              [
                                                  200,
                                                  { "Content-Type" => "text/plain" },
                                                  "All seems to be OK. You can close this window and press ENTER in the application to proceed.",
                                              ]
                                          end
                              
                                      end
                                      Thread.current[:server].run!
                                  }
                              
                              end
                              
                              client_id = Google::Auth::ClientId.new(ENV['GOOGLE_CLIENT_ID'], ENV['GOOGLE_CLIENT_SECRET'])
                              token_store = Google::Auth::Stores::FileTokenStore.new(:file => ENV['GOOGLE_CREDENTIAL_STORE'])
                              PORT = 6969
                              redirect_uri = "http://localhost:#{PORT}/"
                              authorizer = Google::Auth::UserAuthorizer.new(client_id, scope, token_store, redirect_uri)
                              credentials = authorizer.get_credentials(user_id)
                              if credentials.nil? then
                                server_thread = run_local_server(authorizer, PORT, user_id)
                                url = authorizer.get_authorization_url
                                $stderr.puts ""
                                $stderr.puts "-----------------------------------------------"
                                $stderr.puts "Requesting authorization for '#{user_id.yellow}'"
                                $stderr.puts "Open the following URL in your browser and authorize the application."
                                $stderr.puts
                                $stderr.puts url.yellow.bold
                                $stderr.puts
                                $stderr.puts "⚠️ If you are authorizing on a different machine, you will have to port-forward"
                                $stderr.puts "so your browser can reach #{redirect_uri.yellow}"
                                $stderr.puts
                                $stderr.puts "⚠️ If you get a " << "This site can't be reached".red << " error in the browser,"
                                $stderr.puts "just copy the code which is in the code= part of the failing address on the next line."
                                $stderr.puts "E.g., you need only the " << "green".bold.green << " part of the address which looks like"
                                $stderr.puts "#{redirect_uri}?code=".yellow << "4/QMoyZIyzt8uXO6j...j8ajEEjfd".bold.green << "&scope=email%20profile...".yellow
                                $stderr.puts "-----------------------------------------------"
                                code = $stdin.readline.chomp
                                server_thread[:server].stop!
                                server_thread.join
                                credentials = authorizer.get_credentials(user_id)
                                # If the redirect failed, the user must have provided us with a code on their own
                                if credentials.nil? then
                                  credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, scope: scope)
                                end
                              end
                              
                              const {google} = require('googleapis');
                              
                              const oauth2Client = new google.auth.OAuth2(
                                YOUR_CLIENT_ID,
                                YOUR_CLIENT_SECRET,
                                YOUR_REDIRECT_URL
                              );
                              
                              // generate a url that asks permissions for Blogger and Google Calendar scopes
                              const scopes = [
                                'https://www.googleapis.com/auth/blogger',
                                'https://www.googleapis.com/auth/calendar'
                              ];
                              
                              const url = oauth2Client.generateAuthUrl({
                                // 'online' (default) or 'offline' (gets refresh_token)
                                access_type: 'offline',
                              
                                // If you only need one scope you can pass it as a string
                                scope: scopes
                              });
                              
                              # Google Sign-In (OAuth)
                              G_CLIENT_ID=some_id_1234
                              G_CLIENT_SECRET=some_secret_1234
                              PUBLIC_URL=http://localhost:3000
                              
                              const auth = new google.auth.OAuth2(
                                process.env.G_CLIENT_ID,
                                process.env.G_CLIENT_SECRET,
                                `${process.env.PUBLIC_URL}/login`
                              );
                              
                              const oauth2Client = new google.auth.OAuth2(
                                "no_such_id",
                                "no_such_secret",
                                "http://localhost:3000/i_forgot_to_Authorised_this_url"
                              );
                              
                              const {google} = require('googleapis');
                              
                              const oauth2Client = new google.auth.OAuth2(
                                YOUR_CLIENT_ID,
                                YOUR_CLIENT_SECRET,
                                YOUR_REDIRECT_URL
                              );
                              
                              // generate a url that asks permissions for Blogger and Google Calendar scopes
                              const scopes = [
                                'https://www.googleapis.com/auth/blogger',
                                'https://www.googleapis.com/auth/calendar'
                              ];
                              
                              const url = oauth2Client.generateAuthUrl({
                                // 'online' (default) or 'offline' (gets refresh_token)
                                access_type: 'offline',
                              
                                // If you only need one scope you can pass it as a string
                                scope: scopes
                              });
                              
                              # Google Sign-In (OAuth)
                              G_CLIENT_ID=some_id_1234
                              G_CLIENT_SECRET=some_secret_1234
                              PUBLIC_URL=http://localhost:3000
                              
                              const auth = new google.auth.OAuth2(
                                process.env.G_CLIENT_ID,
                                process.env.G_CLIENT_SECRET,
                                `${process.env.PUBLIC_URL}/login`
                              );
                              
                              const oauth2Client = new google.auth.OAuth2(
                                "no_such_id",
                                "no_such_secret",
                                "http://localhost:3000/i_forgot_to_Authorised_this_url"
                              );
                              
                              const {google} = require('googleapis');
                              
                              const oauth2Client = new google.auth.OAuth2(
                                YOUR_CLIENT_ID,
                                YOUR_CLIENT_SECRET,
                                YOUR_REDIRECT_URL
                              );
                              
                              // generate a url that asks permissions for Blogger and Google Calendar scopes
                              const scopes = [
                                'https://www.googleapis.com/auth/blogger',
                                'https://www.googleapis.com/auth/calendar'
                              ];
                              
                              const url = oauth2Client.generateAuthUrl({
                                // 'online' (default) or 'offline' (gets refresh_token)
                                access_type: 'offline',
                              
                                // If you only need one scope you can pass it as a string
                                scope: scopes
                              });
                              
                              # Google Sign-In (OAuth)
                              G_CLIENT_ID=some_id_1234
                              G_CLIENT_SECRET=some_secret_1234
                              PUBLIC_URL=http://localhost:3000
                              
                              const auth = new google.auth.OAuth2(
                                process.env.G_CLIENT_ID,
                                process.env.G_CLIENT_SECRET,
                                `${process.env.PUBLIC_URL}/login`
                              );
                              
                              const oauth2Client = new google.auth.OAuth2(
                                "no_such_id",
                                "no_such_secret",
                                "http://localhost:3000/i_forgot_to_Authorised_this_url"
                              );
                              
                              const {google} = require('googleapis');
                              
                              const oauth2Client = new google.auth.OAuth2(
                                YOUR_CLIENT_ID,
                                YOUR_CLIENT_SECRET,
                                YOUR_REDIRECT_URL
                              );
                              
                              // generate a url that asks permissions for Blogger and Google Calendar scopes
                              const scopes = [
                                'https://www.googleapis.com/auth/blogger',
                                'https://www.googleapis.com/auth/calendar'
                              ];
                              
                              const url = oauth2Client.generateAuthUrl({
                                // 'online' (default) or 'offline' (gets refresh_token)
                                access_type: 'offline',
                              
                                // If you only need one scope you can pass it as a string
                                scope: scopes
                              });
                              
                              # Google Sign-In (OAuth)
                              G_CLIENT_ID=some_id_1234
                              G_CLIENT_SECRET=some_secret_1234
                              PUBLIC_URL=http://localhost:3000
                              
                              const auth = new google.auth.OAuth2(
                                process.env.G_CLIENT_ID,
                                process.env.G_CLIENT_SECRET,
                                `${process.env.PUBLIC_URL}/login`
                              );
                              
                              const oauth2Client = new google.auth.OAuth2(
                                "no_such_id",
                                "no_such_secret",
                                "http://localhost:3000/i_forgot_to_Authorised_this_url"
                              );
                              

                              android:exported needs to be explicitly specified for &lt;activity&gt;. Apps targeting Android 12 and higher are required to specify

                              copy iconCopydownload iconDownload
                              <receiver android:name="<name_of_the_entry>"
                                              android:exported="false or true"
                                              tools:node="merge" />
                              
                                   <activity
                                              android:name="<activity which is giving error>"
                                              android:exported="true"
                                              tools:node="merge" />
                              
                              <activity android:name="name_of_the_activity_inside_library>"
                                  android:exported="false|true"
                                  tools:node="merge" />
                              
                              debugImplementation "androidx.fragment:fragment-testing:<version>"
                              
                              androidTestImplementation "androidx.fragment:fragment-testing:<version>"
                              
                              debugImplementation "androidx.fragment:fragment-testing:<version>"
                              
                              androidTestImplementation "androidx.fragment:fragment-testing:<version>"
                              
                               android:exported="true"
                              
                              androidTestImplementation "androidx.test.ext:junit:1.1.3"
                              androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.0.4"
                              
                              > java.util.concurrent.ExecutionException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/xxxxx.tmp/base.apk (at Binary XML file line #129): YOUR.FULLY.QUALIFIED.NAME.FAILING.ACTIVITY: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present
                              
                              <activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
                              android:exported="true"
                              tools:node="merge"/>
                              
                              <activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
                              android:exported="true"
                              tools:node="merge"/>
                              
                              <activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
                              android:exported="true"
                              tools:node="merge"/>
                              
                               <activity
                                      android:name="com.test.activity.SplashActivity"
                                      android:clearTaskOnLaunch="true"
                                      android:label="@string/app_name"
                                      android:launchMode="singleTop"
                                      android:noHistory="true"
                                      android:screenOrientation="portrait"
                                      android:theme="@style/AppTheme.NoActionBar"
                                      android:exported="true">
                              
                                 <receiver
                                      android:name="com.test.receiver.ShareReceiver"
                                      android:exported="true">
                                      <intent-filter>
                                          <action android:name="com.test.fcm.android.action.broadcast" />
                                      </intent-filter>
                                  </receiver>
                              
                                 <service
                                      android:name="com.google.android.gms.tagmanager.InstallReferrerService"
                                      android:exported="true" />
                              
                              testImplementation 'junit:junit:4.13.2' 
                              androidTestImplementation 'androidx.test:runner:1.4.0'
                              androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
                              implementation 'com.razorpay:checkout:1.6.15'
                              
                               <activity
                                      android:name="com.test.activity.SplashActivity"
                                      android:clearTaskOnLaunch="true"
                                      android:label="@string/app_name"
                                      android:launchMode="singleTop"
                                      android:noHistory="true"
                                      android:screenOrientation="portrait"
                                      android:theme="@style/AppTheme.NoActionBar"
                                      android:exported="true">
                              
                                 <receiver
                                      android:name="com.test.receiver.ShareReceiver"
                                      android:exported="true">
                                      <intent-filter>
                                          <action android:name="com.test.fcm.android.action.broadcast" />
                                      </intent-filter>
                                  </receiver>
                              
                                 <service
                                      android:name="com.google.android.gms.tagmanager.InstallReferrerService"
                                      android:exported="true" />
                              
                              testImplementation 'junit:junit:4.13.2' 
                              androidTestImplementation 'androidx.test:runner:1.4.0'
                              androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
                              implementation 'com.razorpay:checkout:1.6.15'
                              
                               <activity
                                      android:name="com.test.activity.SplashActivity"
                                      android:clearTaskOnLaunch="true"
                                      android:label="@string/app_name"
                                      android:launchMode="singleTop"
                                      android:noHistory="true"
                                      android:screenOrientation="portrait"
                                      android:theme="@style/AppTheme.NoActionBar"
                                      android:exported="true">
                              
                                 <receiver
                                      android:name="com.test.receiver.ShareReceiver"
                                      android:exported="true">
                                      <intent-filter>
                                          <action android:name="com.test.fcm.android.action.broadcast" />
                                      </intent-filter>
                                  </receiver>
                              
                                 <service
                                      android:name="com.google.android.gms.tagmanager.InstallReferrerService"
                                      android:exported="true" />
                              
                              testImplementation 'junit:junit:4.13.2' 
                              androidTestImplementation 'androidx.test:runner:1.4.0'
                              androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
                              implementation 'com.razorpay:checkout:1.6.15'
                              
                              "com.google.dagger:hilt-android:2.38.1"
                              "com.google.dagger:hilt-android-gradle-plugin:2.38.1"
                              "com.google.dagger:hilt-android-compiler:2.38.1"
                              "com.google.dagger:hilt-android-testing:2.38.1"
                              
                              "com.google.dagger:hilt-android:2.40.5"
                              "com.google.dagger:hilt-android-gradle-plugin:2.40.5"
                              "com.google.dagger:hilt-android-compiler:2.40.5"
                              "com.google.dagger:hilt-android-testing:2.40.5" 
                              
                              "com.google.dagger:hilt-android:2.38.1"
                              "com.google.dagger:hilt-android-gradle-plugin:2.38.1"
                              "com.google.dagger:hilt-android-compiler:2.38.1"
                              "com.google.dagger:hilt-android-testing:2.38.1"
                              
                              "com.google.dagger:hilt-android:2.40.5"
                              "com.google.dagger:hilt-android-gradle-plugin:2.40.5"
                              "com.google.dagger:hilt-android-compiler:2.40.5"
                              "com.google.dagger:hilt-android-testing:2.40.5" 
                              
                              <receiver
                                  android:name="com.razorpay.RzpTokenReceiver"
                                  android:exported="false">
                                  <intent-filter>
                                      <action android:name="rzp.device_token.share" />
                                  </intent-filter>
                              </receiver>
                              
                              <activity
                                  android:name="com.razorpay.CheckoutActivity"
                                  android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
                                  android:exported="true"
                                  android:theme="@style/CheckoutTheme">
                                  <intent-filter>
                                      <action android:name="android.intent.action.MAIN" />
                                      <data
                                          android:host="rzp.io"
                                          android:scheme="io.rzp" />
                                  </intent-filter>
                              </activity>
                              
                              android:exported="true" <!-- or false as required -->
                              
                              <activity
                                   android:name=".MainActivity"
                                   android:exported="true" <** add this line on AndroidManifest.xml**
                                   android:launchMode="singleTop"
                                   android:theme="@style/LaunchTheme"
                               </activity>
                              

                              One or more issues found when checking AAR metadata values:

                              copy iconCopydownload iconDownload
                                 compileSdk 31
                              
                                  defaultConfig {
                                      applicationId "com.example.lifecycle"
                                      minSdk 21
                                      targetSdk 30
                                      versionCode 1
                                      versionName "1.0"
                              
                                      testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
                                  }
                              

                              How do I calculate square root in Python?

                              copy iconCopydownload iconDownload
                              >>> import math
                              >>> math.sqrt(9)
                              3.0
                              
                              >>> 9 ** (1/2)
                              3.0
                              >>> 9 ** .5  # Same thing
                              3.0
                              >>> 2 ** .5
                              1.4142135623730951
                              
                              >>> 8 ** (1/3)
                              2.0
                              >>> 125 ** (1/3)
                              4.999999999999999
                              
                              >>> (-25) ** .5  # Should be 5j
                              (3.061616997868383e-16+5j)
                              >>> 8j ** .5  # Should be 2+2j
                              (2.0000000000000004+2j)
                              
                              >>> import cmath
                              >>> cmath.sqrt(-25)
                              5j
                              >>> cmath.sqrt(8j)
                              (2+2j)
                              
                              >>> n = 10**30
                              >>> square = n**2
                              >>> x = square**.5
                              >>> x == n
                              False
                              >>> x - n  # how far off are they?
                              0.0
                              >>> int(x) - n  # how far off is the float from the int?
                              19884624838656
                              
                              >>> decimal.Decimal('9') ** .5
                              Traceback (most recent call last):
                                File "<stdin>", line 1, in <module>
                              TypeError: unsupported operand type(s) for ** or pow(): 'decimal.Decimal' and 'float'
                              >>> decimal.Decimal('9') ** decimal.Decimal('.5')
                              Decimal('3.000000000000000000000000000')
                              
                              >>> import math
                              >>> math.sqrt(9)
                              3.0
                              
                              >>> 9 ** (1/2)
                              3.0
                              >>> 9 ** .5  # Same thing
                              3.0
                              >>> 2 ** .5
                              1.4142135623730951
                              
                              >>> 8 ** (1/3)
                              2.0
                              >>> 125 ** (1/3)
                              4.999999999999999
                              
                              >>> (-25) ** .5  # Should be 5j
                              (3.061616997868383e-16+5j)
                              >>> 8j ** .5  # Should be 2+2j
                              (2.0000000000000004+2j)
                              
                              >>> import cmath
                              >>> cmath.sqrt(-25)
                              5j
                              >>> cmath.sqrt(8j)
                              (2+2j)
                              
                              >>> n = 10**30
                              >>> square = n**2
                              >>> x = square**.5
                              >>> x == n
                              False
                              >>> x - n  # how far off are they?
                              0.0
                              >>> int(x) - n  # how far off is the float from the int?
                              19884624838656
                              
                              >>> decimal.Decimal('9') ** .5
                              Traceback (most recent call last):
                                File "<stdin>", line 1, in <module>
                              TypeError: unsupported operand type(s) for ** or pow(): 'decimal.Decimal' and 'float'
                              >>> decimal.Decimal('9') ** decimal.Decimal('.5')
                              Decimal('3.000000000000000000000000000')
                              
                              >>> import math
                              >>> math.sqrt(9)
                              3.0
                              
                              >>> 9 ** (1/2)
                              3.0
                              >>> 9 ** .5  # Same thing
                              3.0
                              >>> 2 ** .5
                              1.4142135623730951
                              
                              >>> 8 ** (1/3)
                              2.0
                              >>> 125 ** (1/3)
                              4.999999999999999
                              
                              >>> (-25) ** .5  # Should be 5j
                              (3.061616997868383e-16+5j)
                              >>> 8j ** .5  # Should be 2+2j
                              (2.0000000000000004+2j)
                              
                              >>> import cmath
                              >>> cmath.sqrt(-25)
                              5j
                              >>> cmath.sqrt(8j)
                              (2+2j)
                              
                              >>> n = 10**30
                              >>> square = n**2
                              >>> x = square**.5
                              >>> x == n
                              False
                              >>> x - n  # how far off are they?
                              0.0
                              >>> int(x) - n  # how far off is the float from the int?
                              19884624838656
                              
                              >>> decimal.Decimal('9') ** .5
                              Traceback (most recent call last):
                                File "<stdin>", line 1, in <module>
                              TypeError: unsupported operand type(s) for ** or pow(): 'decimal.Decimal' and 'float'
                              >>> decimal.Decimal('9') ** decimal.Decimal('.5')
                              Decimal('3.000000000000000000000000000')
                              
                              >>> import math
                              >>> math.sqrt(9)
                              3.0
                              
                              >>> 9 ** (1/2)
                              3.0
                              >>> 9 ** .5  # Same thing
                              3.0
                              >>> 2 ** .5
                              1.4142135623730951
                              
                              >>> 8 ** (1/3)
                              2.0
                              >>> 125 ** (1/3)
                              4.999999999999999
                              
                              >>> (-25) ** .5  # Should be 5j
                              (3.061616997868383e-16+5j)
                              >>> 8j ** .5  # Should be 2+2j
                              (2.0000000000000004+2j)
                              
                              >>> import cmath
                              >>> cmath.sqrt(-25)
                              5j
                              >>> cmath.sqrt(8j)
                              (2+2j)
                              
                              >>> n = 10**30
                              >>> square = n**2
                              >>> x = square**.5
                              >>> x == n
                              False
                              >>> x - n  # how far off are they?
                              0.0
                              >>> int(x) - n  # how far off is the float from the int?
                              19884624838656
                              
                              >>> decimal.Decimal('9') ** .5
                              Traceback (most recent call last):
                                File "<stdin>", line 1, in <module>
                              TypeError: unsupported operand type(s) for ** or pow(): 'decimal.Decimal' and 'float'
                              >>> decimal.Decimal('9') ** decimal.Decimal('.5')
                              Decimal('3.000000000000000000000000000')
                              
                              >>> import math
                              >>> math.sqrt(9)
                              3.0
                              
                              >>> 9 ** (1/2)
                              3.0
                              >>> 9 ** .5  # Same thing
                              3.0
                              >>> 2 ** .5
                              1.4142135623730951
                              
                              >>> 8 ** (1/3)
                              2.0
                              >>> 125 ** (1/3)
                              4.999999999999999
                              
                              >>> (-25) ** .5  # Should be 5j
                              (3.061616997868383e-16+5j)
                              >>> 8j ** .5  # Should be 2+2j
                              (2.0000000000000004+2j)
                              
                              >>> import cmath
                              >>> cmath.sqrt(-25)
                              5j
                              >>> cmath.sqrt(8j)
                              (2+2j)
                              
                              >>> n = 10**30
                              >>> square = n**2
                              >>> x = square**.5
                              >>> x == n
                              False
                              >>> x - n  # how far off are they?
                              0.0
                              >>> int(x) - n  # how far off is the float from the int?
                              19884624838656
                              
                              >>> decimal.Decimal('9') ** .5
                              Traceback (most recent call last):
                                File "<stdin>", line 1, in <module>
                              TypeError: unsupported operand type(s) for ** or pow(): 'decimal.Decimal' and 'float'
                              >>> decimal.Decimal('9') ** decimal.Decimal('.5')
                              Decimal('3.000000000000000000000000000')
                              
                              >>> import math
                              >>> math.sqrt(9)
                              3.0
                              
                              >>> 9 ** (1/2)
                              3.0
                              >>> 9 ** .5  # Same thing
                              3.0
                              >>> 2 ** .5
                              1.4142135623730951
                              
                              >>> 8 ** (1/3)
                              2.0
                              >>> 125 ** (1/3)
                              4.999999999999999
                              
                              >>> (-25) ** .5  # Should be 5j
                              (3.061616997868383e-16+5j)
                              >>> 8j ** .5  # Should be 2+2j
                              (2.0000000000000004+2j)
                              
                              >>> import cmath
                              >>> cmath.sqrt(-25)
                              5j
                              >>> cmath.sqrt(8j)
                              (2+2j)
                              
                              >>> n = 10**30
                              >>> square = n**2
                              >>> x = square**.5
                              >>> x == n
                              False
                              >>> x - n  # how far off are they?
                              0.0
                              >>> int(x) - n  # how far off is the float from the int?
                              19884624838656
                              
                              >>> decimal.Decimal('9') ** .5
                              Traceback (most recent call last):
                                File "<stdin>", line 1, in <module>
                              TypeError: unsupported operand type(s) for ** or pow(): 'decimal.Decimal' and 'float'
                              >>> decimal.Decimal('9') ** decimal.Decimal('.5')
                              Decimal('3.000000000000000000000000000')
                              
                              >>> import math
                              >>> math.sqrt(9)
                              3.0
                              
                              >>> 9 ** (1/2)
                              3.0
                              >>> 9 ** .5  # Same thing
                              3.0
                              >>> 2 ** .5
                              1.4142135623730951
                              
                              >>> 8 ** (1/3)
                              2.0
                              >>> 125 ** (1/3)
                              4.999999999999999
                              
                              >>> (-25) ** .5  # Should be 5j
                              (3.061616997868383e-16+5j)
                              >>> 8j ** .5  # Should be 2+2j
                              (2.0000000000000004+2j)
                              
                              >>> import cmath
                              >>> cmath.sqrt(-25)
                              5j
                              >>> cmath.sqrt(8j)
                              (2+2j)
                              
                              >>> n = 10**30
                              >>> square = n**2
                              >>> x = square**.5
                              >>> x == n
                              False
                              >>> x - n  # how far off are they?
                              0.0
                              >>> int(x) - n  # how far off is the float from the int?
                              19884624838656
                              
                              >>> decimal.Decimal('9') ** .5
                              Traceback (most recent call last):
                                File "<stdin>", line 1, in <module>
                              TypeError: unsupported operand type(s) for ** or pow(): 'decimal.Decimal' and 'float'
                              >>> decimal.Decimal('9') ** decimal.Decimal('.5')
                              Decimal('3.000000000000000000000000000')
                              
                              >>> import numpy as np
                              >>> np.sqrt(25)
                              5.0
                              >>> np.sqrt([2, 3, 4])
                              array([1.41421356, 1.73205081, 2.        ])
                              
                              >>> a = np.array([4, -1, np.inf])
                              >>> np.sqrt(a)
                              <stdin>:1: RuntimeWarning: invalid value encountered in sqrt
                              array([ 2., nan, inf])
                              >>> np.lib.scimath.sqrt(a)
                              array([ 2.+0.j,  0.+1.j, inf+0.j])
                              
                              >>> a = a.astype(complex)
                              >>> np.sqrt(a)
                              array([ 2.+0.j,  0.+1.j, inf+0.j])
                              
                              >>> import numpy as np
                              >>> np.sqrt(25)
                              5.0
                              >>> np.sqrt([2, 3, 4])
                              array([1.41421356, 1.73205081, 2.        ])
                              
                              >>> a = np.array([4, -1, np.inf])
                              >>> np.sqrt(a)
                              <stdin>:1: RuntimeWarning: invalid value encountered in sqrt
                              array([ 2., nan, inf])
                              >>> np.lib.scimath.sqrt(a)
                              array([ 2.+0.j,  0.+1.j, inf+0.j])
                              
                              >>> a = a.astype(complex)
                              >>> np.sqrt(a)
                              array([ 2.+0.j,  0.+1.j, inf+0.j])
                              
                              >>> import numpy as np
                              >>> np.sqrt(25)
                              5.0
                              >>> np.sqrt([2, 3, 4])
                              array([1.41421356, 1.73205081, 2.        ])
                              
                              >>> a = np.array([4, -1, np.inf])
                              >>> np.sqrt(a)
                              <stdin>:1: RuntimeWarning: invalid value encountered in sqrt
                              array([ 2., nan, inf])
                              >>> np.lib.scimath.sqrt(a)
                              array([ 2.+0.j,  0.+1.j, inf+0.j])
                              
                              >>> a = a.astype(complex)
                              >>> np.sqrt(a)
                              array([ 2.+0.j,  0.+1.j, inf+0.j])
                              
                              import sympy
                              sympy.sqrt(2)
                              # => sqrt(2)
                              
                              sympy.sqrt(8) / sympy.sqrt(27)
                              # => 2*sqrt(6)/9
                              
                              s = sympy.sqrt(2)
                              s**2
                              # => 2
                              type(s**2)
                              #=> <class 'sympy.core.numbers.Integer'>
                              
                              (2**0.5)**2
                              # => 2.0000000000000004
                              
                              from decimal import Decimal
                              (Decimal('2')**Decimal('0.5'))**Decimal('2')
                              # => Decimal('1.999999999999999999999999999')
                              
                              from sympy import Symbol, integrate, pi, sqrt, exp, oo
                              x = Symbol('x')
                              integrate(exp(-x**2), (x, -oo, oo))
                              # => sqrt(pi)
                              integrate(exp(-x**2), (x, -oo, oo)) == sqrt(pi)
                              # => True
                              
                              sympy.N(sympy.sqrt(2), 1_000_000)
                              # => 1.4142135623730950488016...........2044193016904841204
                              
                              import sympy
                              sympy.sqrt(2)
                              # => sqrt(2)
                              
                              sympy.sqrt(8) / sympy.sqrt(27)
                              # => 2*sqrt(6)/9
                              
                              s = sympy.sqrt(2)
                              s**2
                              # => 2
                              type(s**2)
                              #=> <class 'sympy.core.numbers.Integer'>
                              
                              (2**0.5)**2
                              # => 2.0000000000000004
                              
                              from decimal import Decimal
                              (Decimal('2')**Decimal('0.5'))**Decimal('2')
                              # => Decimal('1.999999999999999999999999999')
                              
                              from sympy import Symbol, integrate, pi, sqrt, exp, oo
                              x = Symbol('x')
                              integrate(exp(-x**2), (x, -oo, oo))
                              # => sqrt(pi)
                              integrate(exp(-x**2), (x, -oo, oo)) == sqrt(pi)
                              # => True
                              
                              sympy.N(sympy.sqrt(2), 1_000_000)
                              # => 1.4142135623730950488016...........2044193016904841204
                              
                              import sympy
                              sympy.sqrt(2)
                              # => sqrt(2)
                              
                              sympy.sqrt(8) / sympy.sqrt(27)
                              # => 2*sqrt(6)/9
                              
                              s = sympy.sqrt(2)
                              s**2
                              # => 2
                              type(s**2)
                              #=> <class 'sympy.core.numbers.Integer'>
                              
                              (2**0.5)**2
                              # => 2.0000000000000004
                              
                              from decimal import Decimal
                              (Decimal('2')**Decimal('0.5'))**Decimal('2')
                              # => Decimal('1.999999999999999999999999999')
                              
                              from sympy import Symbol, integrate, pi, sqrt, exp, oo
                              x = Symbol('x')
                              integrate(exp(-x**2), (x, -oo, oo))
                              # => sqrt(pi)
                              integrate(exp(-x**2), (x, -oo, oo)) == sqrt(pi)
                              # => True
                              
                              sympy.N(sympy.sqrt(2), 1_000_000)
                              # => 1.4142135623730950488016...........2044193016904841204
                              
                              import sympy
                              sympy.sqrt(2)
                              # => sqrt(2)
                              
                              sympy.sqrt(8) / sympy.sqrt(27)
                              # => 2*sqrt(6)/9
                              
                              s = sympy.sqrt(2)
                              s**2
                              # => 2
                              type(s**2)
                              #=> <class 'sympy.core.numbers.Integer'>
                              
                              (2**0.5)**2
                              # => 2.0000000000000004
                              
                              from decimal import Decimal
                              (Decimal('2')**Decimal('0.5'))**Decimal('2')
                              # => Decimal('1.999999999999999999999999999')
                              
                              from sympy import Symbol, integrate, pi, sqrt, exp, oo
                              x = Symbol('x')
                              integrate(exp(-x**2), (x, -oo, oo))
                              # => sqrt(pi)
                              integrate(exp(-x**2), (x, -oo, oo)) == sqrt(pi)
                              # => True
                              
                              sympy.N(sympy.sqrt(2), 1_000_000)
                              # => 1.4142135623730950488016...........2044193016904841204
                              
                              import sympy
                              sympy.sqrt(2)
                              # => sqrt(2)
                              
                              sympy.sqrt(8) / sympy.sqrt(27)
                              # => 2*sqrt(6)/9
                              
                              s = sympy.sqrt(2)
                              s**2
                              # => 2
                              type(s**2)
                              #=> <class 'sympy.core.numbers.Integer'>
                              
                              (2**0.5)**2
                              # => 2.0000000000000004
                              
                              from decimal import Decimal
                              (Decimal('2')**Decimal('0.5'))**Decimal('2')
                              # => Decimal('1.999999999999999999999999999')
                              
                              from sympy import Symbol, integrate, pi, sqrt, exp, oo
                              x = Symbol('x')
                              integrate(exp(-x**2), (x, -oo, oo))
                              # => sqrt(pi)
                              integrate(exp(-x**2), (x, -oo, oo)) == sqrt(pi)
                              # => True
                              
                              sympy.N(sympy.sqrt(2), 1_000_000)
                              # => 1.4142135623730950488016...........2044193016904841204
                              
                              import sympy
                              sympy.sqrt(2)
                              # => sqrt(2)
                              
                              sympy.sqrt(8) / sympy.sqrt(27)
                              # => 2*sqrt(6)/9
                              
                              s = sympy.sqrt(2)
                              s**2
                              # => 2
                              type(s**2)
                              #=> <class 'sympy.core.numbers.Integer'>
                              
                              (2**0.5)**2
                              # => 2.0000000000000004
                              
                              from decimal import Decimal
                              (Decimal('2')**Decimal('0.5'))**Decimal('2')
                              # => Decimal('1.999999999999999999999999999')
                              
                              from sympy import Symbol, integrate, pi, sqrt, exp, oo
                              x = Symbol('x')
                              integrate(exp(-x**2), (x, -oo, oo))
                              # => sqrt(pi)
                              integrate(exp(-x**2), (x, -oo, oo)) == sqrt(pi)
                              # => True
                              
                              sympy.N(sympy.sqrt(2), 1_000_000)
                              # => 1.4142135623730950488016...........2044193016904841204
                              
                              def int_squareroot(d: int) -> tuple[int, bool]:
                                  """Try calculating integer squareroot and return if it's exact"""
                                  left, right = 1, (d+1)//2
                                  while left<right-1:
                                      x = (left+right)//2
                                      if x**2 > d:
                                          left, right = left, x
                                      else:
                                          left, right = x, right
                                  return left, left**2==d
                              
                              from fractions import Fraction
                              
                              def sqrt(x, n):
                                  x = x if isinstance(x, Fraction) else Fraction(x)
                                  upper = x + 1
                                  for i in range(0, n):
                                      upper = (upper + x/upper) / 2
                                  lower = x / upper
                                  if lower > upper:
                                      raise ValueError("Sanity check failed")
                                  return (lower, upper)
                              
                              new_estimate = (estimate + num/estimate) / 2
                              
                              def newtons_method(num, estimate):
                                  # Computing a new_estimate
                                  new_estimate = (estimate + num/estimate) / 2
                                  print(new_estimate)
                                  # Base Case: Comparing our estimate with built-in functions value
                                  if new_estimate == math.sqrt(num):
                                      return True
                                  else:
                                      return newtons_method(num, new_estimate)
                              
                              newtons_method(30,5)
                              
                              5.5
                              5.477272727272727
                              5.4772255752546215
                              5.477225575051661
                              
                              new_estimate = (estimate + num/estimate) / 2
                              
                              def newtons_method(num, estimate):
                                  # Computing a new_estimate
                                  new_estimate = (estimate + num/estimate) / 2
                                  print(new_estimate)
                                  # Base Case: Comparing our estimate with built-in functions value
                                  if new_estimate == math.sqrt(num):
                                      return True
                                  else:
                                      return newtons_method(num, new_estimate)
                              
                              newtons_method(30,5)
                              
                              5.5
                              5.477272727272727
                              5.4772255752546215
                              5.477225575051661
                              
                              new_estimate = (estimate + num/estimate) / 2
                              
                              def newtons_method(num, estimate):
                                  # Computing a new_estimate
                                  new_estimate = (estimate + num/estimate) / 2
                                  print(new_estimate)
                                  # Base Case: Comparing our estimate with built-in functions value
                                  if new_estimate == math.sqrt(num):
                                      return True
                                  else:
                                      return newtons_method(num, new_estimate)
                              
                              newtons_method(30,5)
                              
                              5.5
                              5.477272727272727
                              5.4772255752546215
                              5.477225575051661
                              
                              new_estimate = (estimate + num/estimate) / 2
                              
                              def newtons_method(num, estimate):
                                  # Computing a new_estimate
                                  new_estimate = (estimate + num/estimate) / 2
                                  print(new_estimate)
                                  # Base Case: Comparing our estimate with built-in functions value
                                  if new_estimate == math.sqrt(num):
                                      return True
                                  else:
                                      return newtons_method(num, new_estimate)
                              
                              newtons_method(30,5)
                              
                              5.5
                              5.477272727272727
                              5.4772255752546215
                              5.477225575051661
                              
                              from math import isqrt
                              
                              def str_sqrt(num, digits):
                                  """ Arbitrary precision square root
                              
                                      num arg must be a string
                                      Return a string with `digits` after
                                      the decimal point
                              
                                      Written by PM 2Ring 2022.01.26
                                  """
                              
                                  int_part , _, frac_part = num.partition('.')
                                  num = int_part + frac_part
                              
                                  # Determine the required precision
                                  width = 2 * digits - len(frac_part)
                              
                                  # Truncate or pad with zeroes
                                  num = num[:width] if width < 0 else num + '0' * width
                                  s = str(isqrt(int(num)))
                              
                                  if digits:
                                      # Pad, if necessary
                                      s = '0' * (1 + digits - len(s)) + s
                                      s = f"{s[:-digits]}.{s[-digits:]}"
                                  return s
                              
                              print(str_sqrt("2.0", 30))
                              
                              1.414213562373095048801688724209
                              
                              from math import isqrt
                              
                              def str_sqrt(num, digits):
                                  """ Arbitrary precision square root
                              
                                      num arg must be a string
                                      Return a string with `digits` after
                                      the decimal point
                              
                                      Written by PM 2Ring 2022.01.26
                                  """
                              
                                  int_part , _, frac_part = num.partition('.')
                                  num = int_part + frac_part
                              
                                  # Determine the required precision
                                  width = 2 * digits - len(frac_part)
                              
                                  # Truncate or pad with zeroes
                                  num = num[:width] if width < 0 else num + '0' * width
                                  s = str(isqrt(int(num)))
                              
                                  if digits:
                                      # Pad, if necessary
                                      s = '0' * (1 + digits - len(s)) + s
                                      s = f"{s[:-digits]}.{s[-digits:]}"
                                  return s
                              
                              print(str_sqrt("2.0", 30))
                              
                              1.414213562373095048801688724209
                              
                              from math import isqrt
                              
                              def str_sqrt(num, digits):
                                  """ Arbitrary precision square root
                              
                                      num arg must be a string
                                      Return a string with `digits` after
                                      the decimal point
                              
                                      Written by PM 2Ring 2022.01.26
                                  """
                              
                                  int_part , _, frac_part = num.partition('.')
                                  num = int_part + frac_part
                              
                                  # Determine the required precision
                                  width = 2 * digits - len(frac_part)
                              
                                  # Truncate or pad with zeroes
                                  num = num[:width] if width < 0 else num + '0' * width
                                  s = str(isqrt(int(num)))
                              
                                  if digits:
                                      # Pad, if necessary
                                      s = '0' * (1 + digits - len(s)) + s
                                      s = f"{s[:-digits]}.{s[-digits:]}"
                                  return s
                              
                              print(str_sqrt("2.0", 30))
                              
                              1.414213562373095048801688724209
                              

                              Understanding color scales in ggplot2

                              copy iconCopydownload iconDownload
                              library(ggplot2)
                              cont <- ggplot(mtcars, aes(mpg, disp, color=cyl)) + geom_point(size=4)
                              
                              cont + scale_color_continuous()
                              
                              cont + scale_color_binned()
                              
                              discrete <- ggplot(mtcars, aes(mpg, disp, color=as.factor(cyl))) + geom_point(size=4)
                              discrete
                              
                              ggplot(economics, aes(x=date, y=unemploy, fill=date)) + geom_col() +scale_fill_date()
                              
                              ggplot(economics, aes(x=date, y=unemploy, fill=date)) + geom_col() +scale_fill_continuous()
                              
                              > discrete + scale_color_continuous()
                              Error: Discrete value supplied to continuous scale
                              
                              > cont + scale_color_discrete()
                              Error: Continuous value supplied to discrete scale
                              
                              library(ggplot2)
                              cont <- ggplot(mtcars, aes(mpg, disp, color=cyl)) + geom_point(size=4)
                              
                              cont + scale_color_continuous()
                              
                              cont + scale_color_binned()
                              
                              discrete <- ggplot(mtcars, aes(mpg, disp, color=as.factor(cyl))) + geom_point(size=4)
                              discrete
                              
                              ggplot(economics, aes(x=date, y=unemploy, fill=date)) + geom_col() +scale_fill_date()
                              
                              ggplot(economics, aes(x=date, y=unemploy, fill=date)) + geom_col() +scale_fill_continuous()
                              
                              > discrete + scale_color_continuous()
                              Error: Discrete value supplied to continuous scale
                              
                              > cont + scale_color_discrete()
                              Error: Continuous value supplied to discrete scale
                              
                              library(ggplot2)
                              cont <- ggplot(mtcars, aes(mpg, disp, color=cyl)) + geom_point(size=4)
                              
                              cont + scale_color_continuous()
                              
                              cont + scale_color_binned()
                              
                              discrete <- ggplot(mtcars, aes(mpg, disp, color=as.factor(cyl))) + geom_point(size=4)
                              discrete
                              
                              ggplot(economics, aes(x=date, y=unemploy, fill=date)) + geom_col() +scale_fill_date()
                              
                              ggplot(economics, aes(x=date, y=unemploy, fill=date)) + geom_col() +scale_fill_continuous()
                              
                              > discrete + scale_color_continuous()
                              Error: Discrete value supplied to continuous scale
                              
                              > cont + scale_color_discrete()
                              Error: Continuous value supplied to discrete scale
                              
                              library(ggplot2)
                              cont <- ggplot(mtcars, aes(mpg, disp, color=cyl)) + geom_point(size=4)
                              
                              cont + scale_color_continuous()
                              
                              cont + scale_color_binned()
                              
                              discrete <- ggplot(mtcars, aes(mpg, disp, color=as.factor(cyl))) + geom_point(size=4)
                              discrete
                              
                              ggplot(economics, aes(x=date, y=unemploy, fill=date)) + geom_col() +scale_fill_date()
                              
                              ggplot(economics, aes(x=date, y=unemploy, fill=date)) + geom_col() +scale_fill_continuous()
                              
                              > discrete + scale_color_continuous()
                              Error: Discrete value supplied to continuous scale
                              
                              > cont + scale_color_discrete()
                              Error: Continuous value supplied to discrete scale
                              
                              library(ggplot2)
                              cont <- ggplot(mtcars, aes(mpg, disp, color=cyl)) + geom_point(size=4)
                              
                              cont + scale_color_continuous()
                              
                              cont + scale_color_binned()
                              
                              discrete <- ggplot(mtcars, aes(mpg, disp, color=as.factor(cyl))) + geom_point(size=4)
                              discrete
                              
                              ggplot(economics, aes(x=date, y=unemploy, fill=date)) + geom_col() +scale_fill_date()
                              
                              ggplot(economics, aes(x=date, y=unemploy, fill=date)) + geom_col() +scale_fill_continuous()
                              
                              > discrete + scale_color_continuous()
                              Error: Discrete value supplied to continuous scale
                              
                              > cont + scale_color_discrete()
                              Error: Continuous value supplied to discrete scale
                              
                              library(ggplot2)
                              cont <- ggplot(mtcars, aes(mpg, disp, color=cyl)) + geom_point(size=4)
                              
                              cont + scale_color_continuous()
                              
                              cont + scale_color_binned()
                              
                              discrete <- ggplot(mtcars, aes(mpg, disp, color=as.factor(cyl))) + geom_point(size=4)
                              discrete
                              
                              ggplot(economics, aes(x=date, y=unemploy, fill=date)) + geom_col() +scale_fill_date()
                              
                              ggplot(economics, aes(x=date, y=unemploy, fill=date)) + geom_col() +scale_fill_continuous()
                              
                              > discrete + scale_color_continuous()
                              Error: Discrete value supplied to continuous scale
                              
                              > cont + scale_color_discrete()
                              Error: Continuous value supplied to discrete scale
                              
                              scale_col_fill_cont <- function(palette, ...){
                                rcb <- c("Blues", "BuGn", "BuPu", "GnBu", "Greens", "Greys", "Oranges", "OrRd", "PuBu",
                                         "PuBuGn", "PuRd", "Purples", "RdPu", "Reds", "YlGn", "YlGnBu", "YlOrBr", "YlOrRd",
                                         "Accent", "Dark2", "Paired", "Pastel1", "Pastel2", "Set1", "Set2", "Set3",
                                         "BrBG", "PiYG", "PRGn", "PuOr", "RdBu", "RdGy", "RdYlBu", "RdYlGn", "Spectral")
                                rcb_num <- 1:18
                                v <- c("magma", "inferno", "plasma", "viridis", "cividis", "rocket", "mako", "turbo",
                                       "A", "B", "C", "D", "E", "F", "G", "H")
                              
                              
                                if(any(palette == rcb) | any(palette == rcb_num)){
                                  scale_color_distiller(palette= palette, aesthetics= c("colour", "fill"), ...)   
                                } else if(any(palette == v)){
                                  scale_color_viridis_c(option= palette, aesthetics= c("colour", "fill"), ...)
                                } else{
                                  scale_color_continuous(type= palette, aesthetics= c("colour", "fill"), ...)
                               }
                              }
                              
                              scale_col_fill_gradient <- function(low, mid, high, ...){
                                if(missing(mid)){
                                  scale_color_gradient(low= low, high= high, aesthetics= c("colour", "fill"), ...)
                                } else{
                                  scale_color_gradient2(low= low, mid= mid, high= high, aesthetics= c("colour", "fill"), ...)
                                }
                              }
                              
                              # Data
                              n <- 10
                              df <- data.frame(a= 1:n, x= rnorm(n), y= rnorm(n), z= rnorm(n))
                              
                              # ggplot objects
                              library(ggplot2)
                              gg_col <- ggplot(data= df, aes(x, y, col= z)) +
                                geom_point()
                              gg_fill <- ggplot(data= df, aes(a, group= a, fill= z)) +
                                geom_bar()
                              
                              scale_col_fill_cont <- function(palette, ...){
                                rcb <- c("Blues", "BuGn", "BuPu", "GnBu", "Greens", "Greys", "Oranges", "OrRd", "PuBu",
                                         "PuBuGn", "PuRd", "Purples", "RdPu", "Reds", "YlGn", "YlGnBu", "YlOrBr", "YlOrRd",
                                         "Accent", "Dark2", "Paired", "Pastel1", "Pastel2", "Set1", "Set2", "Set3",
                                         "BrBG", "PiYG", "PRGn", "PuOr", "RdBu", "RdGy", "RdYlBu", "RdYlGn", "Spectral")
                                rcb_num <- 1:18
                                v <- c("magma", "inferno", "plasma", "viridis", "cividis", "rocket", "mako", "turbo",
                                       "A", "B", "C", "D", "E", "F", "G", "H")
                              
                              
                                if(any(palette == rcb) | any(palette == rcb_num)){
                                  scale_color_distiller(palette= palette, aesthetics= c("colour", "fill"), ...)   
                                } else if(any(palette == v)){
                                  scale_color_viridis_c(option= palette, aesthetics= c("colour", "fill"), ...)
                                } else{
                                  scale_color_continuous(type= palette, aesthetics= c("colour", "fill"), ...)
                               }
                              }
                              
                              scale_col_fill_gradient <- function(low, mid, high, ...){
                                if(missing(mid)){
                                  scale_color_gradient(low= low, high= high, aesthetics= c("colour", "fill"), ...)
                                } else{
                                  scale_color_gradient2(low= low, mid= mid, high= high, aesthetics= c("colour", "fill"), ...)
                                }
                              }
                              
                              # Data
                              n <- 10
                              df <- data.frame(a= 1:n, x= rnorm(n), y= rnorm(n), z= rnorm(n))
                              
                              # ggplot objects
                              library(ggplot2)
                              gg_col <- ggplot(data= df, aes(x, y, col= z)) +
                                geom_point()
                              gg_fill <- ggplot(data= df, aes(a, group= a, fill= z)) +
                                geom_bar()
                              
                              scale_col_fill_cont <- function(palette, ...){
                                rcb <- c("Blues", "BuGn", "BuPu", "GnBu", "Greens", "Greys", "Oranges", "OrRd", "PuBu",
                                         "PuBuGn", "PuRd", "Purples", "RdPu", "Reds", "YlGn", "YlGnBu", "YlOrBr", "YlOrRd",
                                         "Accent", "Dark2", "Paired", "Pastel1", "Pastel2", "Set1", "Set2", "Set3",
                                         "BrBG", "PiYG", "PRGn", "PuOr", "RdBu", "RdGy", "RdYlBu", "RdYlGn", "Spectral")
                                rcb_num <- 1:18
                                v <- c("magma", "inferno", "plasma", "viridis", "cividis", "rocket", "mako", "turbo",
                                       "A", "B", "C", "D", "E", "F", "G", "H")
                              
                              
                                if(any(palette == rcb) | any(palette == rcb_num)){
                                  scale_color_distiller(palette= palette, aesthetics= c("colour", "fill"), ...)   
                                } else if(any(palette == v)){
                                  scale_color_viridis_c(option= palette, aesthetics= c("colour", "fill"), ...)
                                } else{
                                  scale_color_continuous(type= palette, aesthetics= c("colour", "fill"), ...)
                               }
                              }
                              
                              scale_col_fill_gradient <- function(low, mid, high, ...){
                                if(missing(mid)){
                                  scale_color_gradient(low= low, high= high, aesthetics= c("colour", "fill"), ...)
                                } else{
                                  scale_color_gradient2(low= low, mid= mid, high= high, aesthetics= c("colour", "fill"), ...)
                                }
                              }
                              
                              # Data
                              n <- 10
                              df <- data.frame(a= 1:n, x= rnorm(n), y= rnorm(n), z= rnorm(n))
                              
                              # ggplot objects
                              library(ggplot2)
                              gg_col <- ggplot(data= df, aes(x, y, col= z)) +
                                geom_point()
                              gg_fill <- ggplot(data= df, aes(a, group= a, fill= z)) +
                                geom_bar()
                              

                              How can I efficiently calculate a quadratic form in Julia?

                              copy iconCopydownload iconDownload
                              julia> a = rand(10000); b = rand(10000);
                              
                              julia> x = rand(10000, 10000); x = (x + x') / 2;
                              
                              julia> y = Symmetric(x);
                              
                              julia> @btime dot($a, $x, $b);
                                47.000 ms (0 allocations: 0 bytes)
                              
                              julia> @btime dot($a, $y, $b);
                                27.392 ms (0 allocations: 0 bytes)
                              
                              julia> # a, b, x are the same as in Bogumił's answer
                              
                              julia> @btime dot($a, $x, $b);
                                82.305 ms (0 allocations: 0 bytes)
                              
                              julia> f(a, x, b) = @tullio r := a[i] * x[i,j] * b[j]
                              f (generic function with 1 method)
                              
                              julia> @btime f($a, $x, $b);
                                80.430 ms (1 allocation: 16 bytes)
                              
                              julia> using LoopVectorization
                              
                              julia> f3(a, x, b) = @tullio r := a[i] * x[i,j] * b[j]
                              f3 (generic function with 1 method)
                              
                              julia> @btime f3($a, $x, $b);
                                73.239 ms (1 allocation: 16 bytes)
                              
                              julia> @btime dot($a, $(Symmetric(x)), $b);
                                42.896 ms (0 allocations: 0 bytes)
                              
                              julia> # a, b, x are the same as in Bogumił's answer
                              
                              julia> @btime dot($a, $x, $b);
                                82.305 ms (0 allocations: 0 bytes)
                              
                              julia> f(a, x, b) = @tullio r := a[i] * x[i,j] * b[j]
                              f (generic function with 1 method)
                              
                              julia> @btime f($a, $x, $b);
                                80.430 ms (1 allocation: 16 bytes)
                              
                              julia> using LoopVectorization
                              
                              julia> f3(a, x, b) = @tullio r := a[i] * x[i,j] * b[j]
                              f3 (generic function with 1 method)
                              
                              julia> @btime f3($a, $x, $b);
                                73.239 ms (1 allocation: 16 bytes)
                              
                              julia> @btime dot($a, $(Symmetric(x)), $b);
                                42.896 ms (0 allocations: 0 bytes)
                              
                              julia> # a, b, x are the same as in Bogumił's answer
                              
                              julia> @btime dot($a, $x, $b);
                                82.305 ms (0 allocations: 0 bytes)
                              
                              julia> f(a, x, b) = @tullio r := a[i] * x[i,j] * b[j]
                              f (generic function with 1 method)
                              
                              julia> @btime f($a, $x, $b);
                                80.430 ms (1 allocation: 16 bytes)
                              
                              julia> using LoopVectorization
                              
                              julia> f3(a, x, b) = @tullio r := a[i] * x[i,j] * b[j]
                              f3 (generic function with 1 method)
                              
                              julia> @btime f3($a, $x, $b);
                                73.239 ms (1 allocation: 16 bytes)
                              
                              julia> @btime dot($a, $(Symmetric(x)), $b);
                                42.896 ms (0 allocations: 0 bytes)
                              
                              1.7.0> using BenchmarkTools, LinearAlgebra
                              
                              1.7.0> X = rand(100,100); y=rand(100);
                              
                              1.7.0> @btime $y' * $X * $y
                                42.800 μs (1 allocation: 896 bytes)
                              1213.5489200642382
                              
                              1.7.0> @btime dot($y, $X, $y)
                                1.540 μs (0 allocations: 0 bytes)
                              1213.548920064238
                              
                              1.7.0> X = rand(10000,10000); y=rand(10000);
                              
                              1.7.0> @btime $y' * $X * $y
                                33.790 ms (2 allocations: 78.17 KiB)
                              1.2507105095988091e7
                              
                              1.7.0> @btime dot($y, $X, $y)
                                44.849 ms (0 allocations: 0 bytes)
                              1.2507105095988117e7
                              
                              1.7.0> using BenchmarkTools, LinearAlgebra
                              
                              1.7.0> X = rand(100,100); y=rand(100);
                              
                              1.7.0> @btime $y' * $X * $y
                                42.800 μs (1 allocation: 896 bytes)
                              1213.5489200642382
                              
                              1.7.0> @btime dot($y, $X, $y)
                                1.540 μs (0 allocations: 0 bytes)
                              1213.548920064238
                              
                              1.7.0> X = rand(10000,10000); y=rand(10000);
                              
                              1.7.0> @btime $y' * $X * $y
                                33.790 ms (2 allocations: 78.17 KiB)
                              1.2507105095988091e7
                              
                              1.7.0> @btime dot($y, $X, $y)
                                44.849 ms (0 allocations: 0 bytes)
                              1.2507105095988117e7
                              

                              What is the significance of 'strongly happens before' compared to '(simply) happens before'?

                              copy iconCopydownload iconDownload
                              atomic_int x = 0, y = 0;
                              int a = 0, b = 0, c = 0;
                              // Thread 1
                              x.store(1, seq_cst);
                              y.store(1, release);
                              // Thread 2
                              b = y.fetch_add(1, seq_cst); // b = 1 (the value of y before increment)
                              c = y.load(relaxed); // c = 3
                              // Thread 3
                              y.store(3, seq_cst);
                              a = x.load(seq_cst); // a = 0
                              
                              .-- T3 y.store(3, seq_cst);                   --.                 (2)
                              |        |                                      | strongly
                              |        | sequenced before                     | happens
                              |        V                                      | before
                              |   T3 a = x.load(seq_cst); // a = 0    --.   <-'                 (3)
                              |                                         : coherence-
                              |                                         : ordered
                              |                                         : before
                              |   T1 x.store(1, seq_cst);             <-'   --. --.             (4)
                              |        |                                      |st |
                              |        | sequenced before                     |h  |
                              |        V                                      |b  |
                              | . T1 y.store(1, release);                   <-'   |
                              | |      :                                          | strongly
                              | |      : synchronizes with                        | happens
                              | |      V                                          | before
                              | > T2 b = y.fetch_add(1, seq_cst); // b = 1  --.   |             (1)
                              |        |                                      |st |
                              |        | sequenced before                     |h  |
                              |        V                                      |b  |
                              '-> T2 c = y.load(relaxed); // c = 3          <-' <-'
                              
                              atomic_int x = 0, y = 0;
                              int a = 0, b = 0, c = 0;
                              // Thread 1
                              x.store(1, seq_cst);
                              y.store(1, release);
                              // Thread 2
                              b = y.fetch_add(1, seq_cst); // b = 1 (the value of y before increment)
                              c = y.load(relaxed); // c = 3
                              // Thread 3
                              y.store(3, seq_cst);
                              a = x.load(seq_cst); // a = 0
                              
                              .-- T3 y.store(3, seq_cst);                   --.                 (2)
                              |        |                                      | strongly
                              |        | sequenced before                     | happens
                              |        V                                      | before
                              |   T3 a = x.load(seq_cst); // a = 0    --.   <-'                 (3)
                              |                                         : coherence-
                              |                                         : ordered
                              |                                         : before
                              |   T1 x.store(1, seq_cst);             <-'   --. --.             (4)
                              |        |                                      |st |
                              |        | sequenced before                     |h  |
                              |        V                                      |b  |
                              | . T1 y.store(1, release);                   <-'   |
                              | |      :                                          | strongly
                              | |      : synchronizes with                        | happens
                              | |      V                                          | before
                              | > T2 b = y.fetch_add(1, seq_cst); // b = 1  --.   |             (1)
                              |        |                                      |st |
                              |        | sequenced before                     |h  |
                              |        V                                      |b  |
                              '-> T2 c = y.load(relaxed); // c = 3          <-' <-'
                              

                              Use recode to mutate across multiple columns using named list of named vectors

                              copy iconCopydownload iconDownload
                              library(tidyverse)
                              
                              map2_dfr(test %>% select(names(dicts)),
                                       dicts,
                                       ~ recode(.x,!!!.y)) %>%
                                dplyr::bind_cols(., Names = test$Names) %>%
                                dplyr::select(4, 1:3)
                              
                              # A tibble: 3 × 4
                                Names A       B     C      
                                <chr> <chr>   <chr> <chr>  
                              1 Alice charlie yes   delta  
                              2 Bob   delta   no    epsilon
                              3 Cindy bravo   bad   beta 
                              
                              library(tidyverse)
                              
                              map2_dfr(test %>% select(names(dicts)),
                                       dicts,
                                       ~ recode(.x,!!!.y)) %>%
                                dplyr::bind_cols(., Names = test$Names) %>%
                                dplyr::select(4, 1:3)
                              
                              # A tibble: 3 × 4
                                Names A       B     C      
                                <chr> <chr>   <chr> <chr>  
                              1 Alice charlie yes   delta  
                              2 Bob   delta   no    epsilon
                              3 Cindy bravo   bad   beta 
                              
                              library(dplyr)
                              library(tidyr)
                              
                              test %>% 
                               pivot_longer(-1) %>% 
                               left_join(stack(dicts) %>% 
                                           rownames_to_column('value'),
                                         by = c('value',  'name' = 'ind')) %>% 
                               pivot_wider(id_cols = -value, names_from = name, values_from = values)
                              
                              # A tibble: 3 x 4
                              #  Names A       B     C      
                              #  <chr> <chr>   <chr> <chr>  
                              #1 Alice charlie yes   delta  
                              #2 Bob   delta   no    epsilon
                              #3 Cindy bravo   bad   beta   
                              
                              library(tidyverse)
                              
                              myfun <- function(x) {
                                mycol <- cur_column()
                                dplyr::recode(x, !!! dicts[[mycol]])
                              }
                              
                              test %>% 
                                mutate(across(c("A", "B", "C"), myfun))
                              
                              #> # A tibble: 3 x 4
                              #>   Names A       B     C      
                              #>   <chr> <chr>   <chr> <chr>  
                              #> 1 Alice charlie yes   delta  
                              #> 2 Bob   delta   no    epsilon
                              #> 3 Cindy bravo   bad   beta
                              
                              expr_ls <-  imap(dicts, ~ quo(recode(!!sym(.y), !!!.x)))
                              
                              test %>% 
                                mutate(!!! expr_ls)
                              
                              #> # A tibble: 3 x 4
                              #>   Names A       B     C      
                              #>   <chr> <chr>   <chr> <chr>  
                              #> 1 Alice charlie yes   delta  
                              #> 2 Bob   delta   no    epsilon
                              #> 3 Cindy bravo   bad   beta
                              
                              myfun2 <- function(x) {
                                x_nm <- names(x)
                                mutate(x, !! x_nm := recode(!! sym(x_nm), !!! dicts[[x_nm]]))
                              }
                              
                              lmap_at(test, 
                                      names(dicts),
                                      myfun2)
                              #> # A tibble: 3 x 4
                              #>   Names A       B     C      
                              #>   <chr> <chr>   <chr> <chr>  
                              #> 1 Alice charlie yes   delta  
                              #> 2 Bob   delta   no    epsilon
                              #> 3 Cindy bravo   bad   beta
                              
                              # Starting tibble
                              test <- tibble(Names = c("Alice","Bob","Cindy"),
                                             A = c(3,"q",7),
                                             B = c(1,2,"b"),
                                             C = c("a","g",9))
                              
                              # Named vector
                              A <- c("5" = "alpha", "7" = "bravo", "3" = "charlie", "q" = "delta")
                              B <- c("1" = "yes", "2" = "no", "b" = "bad", "c" = "missing")
                              C <- c("9" = "beta", "8" = "gamma", "a" = "delta", "g" = "epsilon")
                              
                              # Named list of named vectors
                              dicts <- list("A" = A, "B" = B, "C" = C) # Same names as columns
                              
                              library(tidyverse)
                              
                              myfun <- function(x) {
                                mycol <- cur_column()
                                dplyr::recode(x, !!! dicts[[mycol]])
                              }
                              
                              test %>% 
                                mutate(across(c("A", "B", "C"), myfun))
                              
                              #> # A tibble: 3 x 4
                              #>   Names A       B     C      
                              #>   <chr> <chr>   <chr> <chr>  
                              #> 1 Alice charlie yes   delta  
                              #> 2 Bob   delta   no    epsilon
                              #> 3 Cindy bravo   bad   beta
                              
                              expr_ls <-  imap(dicts, ~ quo(recode(!!sym(.y), !!!.x)))
                              
                              test %>% 
                                mutate(!!! expr_ls)
                              
                              #> # A tibble: 3 x 4
                              #>   Names A       B     C      
                              #>   <chr> <chr>   <chr> <chr>  
                              #> 1 Alice charlie yes   delta  
                              #> 2 Bob   delta   no    epsilon
                              #> 3 Cindy bravo   bad   beta
                              
                              myfun2 <- function(x) {
                                x_nm <- names(x)
                                mutate(x, !! x_nm := recode(!! sym(x_nm), !!! dicts[[x_nm]]))
                              }
                              
                              lmap_at(test, 
                                      names(dicts),
                                      myfun2)
                              #> # A tibble: 3 x 4
                              #>   Names A       B     C      
                              #>   <chr> <chr>   <chr> <chr>  
                              #> 1 Alice charlie yes   delta  
                              #> 2 Bob   delta   no    epsilon
                              #> 3 Cindy bravo   bad   beta
                              
                              # Starting tibble
                              test <- tibble(Names = c("Alice","Bob","Cindy"),
                                             A = c(3,"q",7),
                                             B = c(1,2,"b"),
                                             C = c("a","g",9))
                              
                              # Named vector
                              A <- c("5" = "alpha", "7" = "bravo", "3" = "charlie", "q" = "delta")
                              B <- c("1" = "yes", "2" = "no", "b" = "bad", "c" = "missing")
                              C <- c("9" = "beta", "8" = "gamma", "a" = "delta", "g" = "epsilon")
                              
                              # Named list of named vectors
                              dicts <- list("A" = A, "B" = B, "C" = C) # Same names as columns
                              
                              library(tidyverse)
                              
                              myfun <- function(x) {
                                mycol <- cur_column()
                                dplyr::recode(x, !!! dicts[[mycol]])
                              }
                              
                              test %>% 
                                mutate(across(c("A", "B", "C"), myfun))
                              
                              #> # A tibble: 3 x 4
                              #>   Names A       B     C      
                              #>   <chr> <chr>   <chr> <chr>  
                              #> 1 Alice charlie yes   delta  
                              #> 2 Bob   delta   no    epsilon
                              #> 3 Cindy bravo   bad   beta
                              
                              expr_ls <-  imap(dicts, ~ quo(recode(!!sym(.y), !!!.x)))
                              
                              test %>% 
                                mutate(!!! expr_ls)
                              
                              #> # A tibble: 3 x 4
                              #>   Names A       B     C      
                              #>   <chr> <chr>   <chr> <chr>  
                              #> 1 Alice charlie yes   delta  
                              #> 2 Bob   delta   no    epsilon
                              #> 3 Cindy bravo   bad   beta
                              
                              myfun2 <- function(x) {
                                x_nm <- names(x)
                                mutate(x, !! x_nm := recode(!! sym(x_nm), !!! dicts[[x_nm]]))
                              }
                              
                              lmap_at(test, 
                                      names(dicts),
                                      myfun2)
                              #> # A tibble: 3 x 4
                              #>   Names A       B     C      
                              #>   <chr> <chr>   <chr> <chr>  
                              #> 1 Alice charlie yes   delta  
                              #> 2 Bob   delta   no    epsilon
                              #> 3 Cindy bravo   bad   beta
                              
                              # Starting tibble
                              test <- tibble(Names = c("Alice","Bob","Cindy"),
                                             A = c(3,"q",7),
                                             B = c(1,2,"b"),
                                             C = c("a","g",9))
                              
                              # Named vector
                              A <- c("5" = "alpha", "7" = "bravo", "3" = "charlie", "q" = "delta")
                              B <- c("1" = "yes", "2" = "no", "b" = "bad", "c" = "missing")
                              C <- c("9" = "beta", "8" = "gamma", "a" = "delta", "g" = "epsilon")
                              
                              # Named list of named vectors
                              dicts <- list("A" = A, "B" = B, "C" = C) # Same names as columns
                              
                              library(tidyverse)
                              
                              myfun <- function(x) {
                                mycol <- cur_column()
                                dplyr::recode(x, !!! dicts[[mycol]])
                              }
                              
                              test %>% 
                                mutate(across(c("A", "B", "C"), myfun))
                              
                              #> # A tibble: 3 x 4
                              #>   Names A       B     C      
                              #>   <chr> <chr>   <chr> <chr>  
                              #> 1 Alice charlie yes   delta  
                              #> 2 Bob   delta   no    epsilon
                              #> 3 Cindy bravo   bad   beta
                              
                              expr_ls <-  imap(dicts, ~ quo(recode(!!sym(.y), !!!.x)))
                              
                              test %>% 
                                mutate(!!! expr_ls)
                              
                              #> # A tibble: 3 x 4
                              #>   Names A       B     C      
                              #>   <chr> <chr>   <chr> <chr>  
                              #> 1 Alice charlie yes   delta  
                              #> 2 Bob   delta   no    epsilon
                              #> 3 Cindy bravo   bad   beta
                              
                              myfun2 <- function(x) {
                                x_nm <- names(x)
                                mutate(x, !! x_nm := recode(!! sym(x_nm), !!! dicts[[x_nm]]))
                              }
                              
                              lmap_at(test, 
                                      names(dicts),
                                      myfun2)
                              #> # A tibble: 3 x 4
                              #>   Names A       B     C      
                              #>   <chr> <chr>   <chr> <chr>  
                              #> 1 Alice charlie yes   delta  
                              #> 2 Bob   delta   no    epsilon
                              #> 3 Cindy bravo   bad   beta
                              
                              # Starting tibble
                              test <- tibble(Names = c("Alice","Bob","Cindy"),
                                             A = c(3,"q",7),
                                             B = c(1,2,"b"),
                                             C = c("a","g",9))
                              
                              # Named vector
                              A <- c("5" = "alpha", "7" = "bravo", "3" = "charlie", "q" = "delta")
                              B <- c("1" = "yes", "2" = "no", "b" = "bad", "c" = "missing")
                              C <- c("9" = "beta", "8" = "gamma", "a" = "delta", "g" = "epsilon")
                              
                              # Named list of named vectors
                              dicts <- list("A" = A, "B" = B, "C" = C) # Same names as columns
                              
                              idx <- match(names(dicts), names(test))
                              test[idx] <- Map(`[`, dicts, test[idx])
                              
                              > test
                              # A tibble: 3 x 4
                                Names A       B     C
                                <chr> <chr>   <chr> <chr>
                              1 Alice charlie yes   delta
                              2 Bob   delta   no    epsilon
                              3 Cindy bravo   bad   beta
                              
                              idx <- match(names(dicts), names(test))
                              test[idx] <- Map(`[`, dicts, test[idx])
                              
                              > test
                              # A tibble: 3 x 4
                                Names A       B     C
                                <chr> <chr>   <chr> <chr>
                              1 Alice charlie yes   delta
                              2 Bob   delta   no    epsilon
                              3 Cindy bravo   bad   beta
                              
                              for (x in names(dicts)) { test[[x]] <- do.call(recode, c(list(test[[x]]), dicts[[x]])) }
                              
                              > test
                              # A tibble: 3 × 4
                                Names A       B     C      
                                <chr> <chr>   <chr> <chr>  
                              1 Alice charlie yes   delta  
                              2 Bob   delta   no    epsilon
                              3 Cindy bravo   bad   beta   
                              
                              # Helper function
                              look_dict <- function(col, values) dicts[[col]][values]
                              
                              # lapply
                              test[names(dicts)] <- lapply(names(dicts), \(col) look_dict(col, test[[col]]))
                              
                              # magrittr and for loop to avoid repeating code
                              library(magrittr)
                              for (col in names(dicts)) test[[col]] %<>% look_dict(col, .)
                              
                              # # A tibble: 3 x 4
                              #   Names A       B     C      
                              #   <chr> <chr>   <chr> <chr>  
                              # 1 Alice charlie yes   delta  
                              # 2 Bob   delta   no    epsilon
                              # 3 Cindy bravo   bad   beta   
                              
                              test %>% 
                                mutate(across(
                                  c("A", "B", "C"),
                                  ~qdap::mgsub( names(dicts[[cur_column()]]), dicts[[cur_column()]], .x)
                                  ))
                              
                              bench::mark(
                                karl_base_r(data, dicts),
                                tim_across(data, dicts),
                                tim_lmap(data, dicts),
                                sotos_pivot(data, dicts),
                                thomas_base_r(data, dicts),
                                sindri_base_r(data, dicts),
                                check = FALSE
                              )
                              #> # A tibble: 6 x 6
                              #>   expression                      min   median `itr/sec` mem_alloc `gc/sec`
                              #>   <bch:expr>                 <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
                              #> 1 karl_base_r(data, dicts)    825.9us  968.9us     814.   428.17KB     6.25
                              #> 2 tim_across(data, dicts)      5.04ms   6.44ms     147.      2.4MB     4.15
                              #> 3 tim_lmap(data, dicts)        7.34ms   8.49ms     108.   106.06KB     4.17
                              #> 4 sotos_pivot(data, dicts)    12.79ms  14.58ms      60.6    1.26MB     4.18
                              #> 5 thomas_base_r(data, dicts)    392us  438.6us    1891.         0B     4.07
                              #> 6 sindir_base_r(data, dicts)  116.8us  136.7us    5793.         0B     4.11
                              
                              set.seed(15)
                              data_large <- data %>% sample_n(1e6, replace = TRUE)
                              
                              bench::mark(
                                karl_base_r(data_large, dicts),
                                tim_across(data_large, dicts),
                                tim_lmap(data_large, dicts),
                                thomas_base_r(data_large, dicts),
                                sindir_base_r(data_large, dicts),
                                check = FALSE
                              )
                              #> Warning: Some expressions had a GC in every iteration; so filtering is disabled.
                              #> # A tibble: 5 x 6
                              #>   expression                            min  median `itr/sec` mem_alloc `gc/sec`
                              #>   <bch:expr>                       <bch:tm> <bch:t>     <dbl> <bch:byt>    <dbl>
                              #> 1 karl_base_r(data_large, dicts)      856ms   856ms      1.17   503.9MB     9.35
                              #> 2 tim_across(data_large, dicts)       647ms   647ms      1.55   504.9MB    10.8 
                              #> 3 tim_lmap(data_large, dicts)         809ms   809ms      1.24   503.6MB    11.1 
                              #> 4 thomas_base_r(data_large, dicts)    131ms   148ms      6.53    80.1MB     3.27
                              #> 5 sindir_base_r(data_large, dicts)    150ms   180ms      5.08    80.1MB     5.08
                              
                              library(tidyverse)
                              library(magrittr)
                              
                              # Starting tibble
                              data <- tibble(Names = c("Alice","Bob","Cindy"),
                                             A = c(3,"q",7),
                                             B = c(1,2,"b"),
                                             C = c("a","g",9))
                              
                              # Named vector
                              A <- c("5" = "alpha", "7" = "bravo", "3" = "charlie", "q" = "delta")
                              B <- c("1" = "yes", "2" = "no", "b" = "bad", "c" = "missing")
                              C <- c("9" = "beta", "8" = "gamma", "a" = "delta", "g" = "epsilon")
                              
                              # Named list of named vectors
                              dicts <- list("A" = A, "B" = B, "C" = C) # Same names as columns
                              
                              
                              # function definitions 
                              
                              karl_base_r <- function(data, dicts) {
                                for (x in names(dicts)) 
                                  {data[[x]] <- do.call(recode, c(list(data[[x]]), dicts[[x]])) }
                                
                                data
                              }
                              
                              tim_across <- function(data, dicts) {
                                
                                myfun <- function(x) {
                                  mycol <- cur_column()
                                  dplyr::recode(x, !!! dicts[[mycol]])
                                }
                                
                                data %>% 
                                  mutate(across(c("A", "B", "C"), myfun))
                              }
                              
                              tim_lmap <- function(data, dicts) {
                                myfun2 <- function(x) {
                                  x_nm <- names(x)
                                  mutate(x, !! x_nm := recode(!! sym(x_nm), !!! dicts[[x_nm]]))
                                }
                                
                                lmap_at(data, 
                                        names(dicts),
                                        myfun2)
                              }
                              
                              sotos_pivot <- function(data, dicts) {
                                data %>% 
                                  pivot_longer(-1) %>% 
                                  left_join(stack(dicts) %>% 
                                              rownames_to_column('value'),
                                            by = c('value',  'name' = 'ind')) %>% 
                                  pivot_wider(id_cols = -value, names_from = name, values_from = values)
                              }
                              
                              thomas_base_r <- function(data, dicts) {
                                idx <- match(names(dicts), names(data))
                                data[idx] <- Map(`[`, dicts, data[idx])
                                data
                              }
                              
                              sindri_base_r <- function(data, dicts) {
                                look_dict <- function(col, values) dicts[[col]][values]
                                
                                data[names(dicts)] <- lapply(names(dicts), \(col) look_dict(col, data[[col]]))
                                data
                              }
                              
                              bench::mark(
                                karl_base_r(data, dicts),
                                tim_across(data, dicts),
                                tim_lmap(data, dicts),
                                sotos_pivot(data, dicts),
                                thomas_base_r(data, dicts),
                                sindri_base_r(data, dicts),
                                check = FALSE
                              )
                              #> # A tibble: 6 x 6
                              #>   expression                      min   median `itr/sec` mem_alloc `gc/sec`
                              #>   <bch:expr>                 <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
                              #> 1 karl_base_r(data, dicts)    825.9us  968.9us     814.   428.17KB     6.25
                              #> 2 tim_across(data, dicts)      5.04ms   6.44ms     147.      2.4MB     4.15
                              #> 3 tim_lmap(data, dicts)        7.34ms   8.49ms     108.   106.06KB     4.17
                              #> 4 sotos_pivot(data, dicts)    12.79ms  14.58ms      60.6    1.26MB     4.18
                              #> 5 thomas_base_r(data, dicts)    392us  438.6us    1891.         0B     4.07
                              #> 6 sindir_base_r(data, dicts)  116.8us  136.7us    5793.         0B     4.11
                              
                              set.seed(15)
                              data_large <- data %>% sample_n(1e6, replace = TRUE)
                              
                              bench::mark(
                                karl_base_r(data_large, dicts),
                                tim_across(data_large, dicts),
                                tim_lmap(data_large, dicts),
                                thomas_base_r(data_large, dicts),
                                sindir_base_r(data_large, dicts),
                                check = FALSE
                              )
                              #> Warning: Some expressions had a GC in every iteration; so filtering is disabled.
                              #> # A tibble: 5 x 6
                              #>   expression                            min  median `itr/sec` mem_alloc `gc/sec`
                              #>   <bch:expr>                       <bch:tm> <bch:t>     <dbl> <bch:byt>    <dbl>
                              #> 1 karl_base_r(data_large, dicts)      856ms   856ms      1.17   503.9MB     9.35
                              #> 2 tim_across(data_large, dicts)       647ms   647ms      1.55   504.9MB    10.8 
                              #> 3 tim_lmap(data_large, dicts)         809ms   809ms      1.24   503.6MB    11.1 
                              #> 4 thomas_base_r(data_large, dicts)    131ms   148ms      6.53    80.1MB     3.27
                              #> 5 sindir_base_r(data_large, dicts)    150ms   180ms      5.08    80.1MB     5.08
                              
                              library(tidyverse)
                              library(magrittr)
                              
                              # Starting tibble
                              data <- tibble(Names = c("Alice","Bob","Cindy"),
                                             A = c(3,"q",7),
                                             B = c(1,2,"b"),
                                             C = c("a","g",9))
                              
                              # Named vector
                              A <- c("5" = "alpha", "7" = "bravo", "3" = "charlie", "q" = "delta")
                              B <- c("1" = "yes", "2" = "no", "b" = "bad", "c" = "missing")
                              C <- c("9" = "beta", "8" = "gamma", "a" = "delta", "g" = "epsilon")
                              
                              # Named list of named vectors
                              dicts <- list("A" = A, "B" = B, "C" = C) # Same names as columns
                              
                              
                              # function definitions 
                              
                              karl_base_r <- function(data, dicts) {
                                for (x in names(dicts)) 
                                  {data[[x]] <- do.call(recode, c(list(data[[x]]), dicts[[x]])) }
                                
                                data
                              }
                              
                              tim_across <- function(data, dicts) {
                                
                                myfun <- function(x) {
                                  mycol <- cur_column()
                                  dplyr::recode(x, !!! dicts[[mycol]])
                                }
                                
                                data %>% 
                                  mutate(across(c("A", "B", "C"), myfun))
                              }
                              
                              tim_lmap <- function(data, dicts) {
                                myfun2 <- function(x) {
                                  x_nm <- names(x)
                                  mutate(x, !! x_nm := recode(!! sym(x_nm), !!! dicts[[x_nm]]))
                                }
                                
                                lmap_at(data, 
                                        names(dicts),
                                        myfun2)
                              }
                              
                              sotos_pivot <- function(data, dicts) {
                                data %>% 
                                  pivot_longer(-1) %>% 
                                  left_join(stack(dicts) %>% 
                                              rownames_to_column('value'),
                                            by = c('value',  'name' = 'ind')) %>% 
                                  pivot_wider(id_cols = -value, names_from = name, values_from = values)
                              }
                              
                              thomas_base_r <- function(data, dicts) {
                                idx <- match(names(dicts), names(data))
                                data[idx] <- Map(`[`, dicts, data[idx])
                                data
                              }
                              
                              sindri_base_r <- function(data, dicts) {
                                look_dict <- function(col, values) dicts[[col]][values]
                                
                                data[names(dicts)] <- lapply(names(dicts), \(col) look_dict(col, data[[col]]))
                                data
                              }
                              
                              bench::mark(
                                karl_base_r(data, dicts),
                                tim_across(data, dicts),
                                tim_lmap(data, dicts),
                                sotos_pivot(data, dicts),
                                thomas_base_r(data, dicts),
                                sindri_base_r(data, dicts),
                                check = FALSE
                              )
                              #> # A tibble: 6 x 6
                              #>   expression                      min   median `itr/sec` mem_alloc `gc/sec`
                              #>   <bch:expr>                 <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
                              #> 1 karl_base_r(data, dicts)    825.9us  968.9us     814.   428.17KB     6.25
                              #> 2 tim_across(data, dicts)      5.04ms   6.44ms     147.      2.4MB     4.15
                              #> 3 tim_lmap(data, dicts)        7.34ms   8.49ms     108.   106.06KB     4.17
                              #> 4 sotos_pivot(data, dicts)    12.79ms  14.58ms      60.6    1.26MB     4.18
                              #> 5 thomas_base_r(data, dicts)    392us  438.6us    1891.         0B     4.07
                              #> 6 sindir_base_r(data, dicts)  116.8us  136.7us    5793.         0B     4.11
                              
                              set.seed(15)
                              data_large <- data %>% sample_n(1e6, replace = TRUE)
                              
                              bench::mark(
                                karl_base_r(data_large, dicts),
                                tim_across(data_large, dicts),
                                tim_lmap(data_large, dicts),
                                thomas_base_r(data_large, dicts),
                                sindir_base_r(data_large, dicts),
                                check = FALSE
                              )
                              #> Warning: Some expressions had a GC in every iteration; so filtering is disabled.
                              #> # A tibble: 5 x 6
                              #>   expression                            min  median `itr/sec` mem_alloc `gc/sec`
                              #>   <bch:expr>                       <bch:tm> <bch:t>     <dbl> <bch:byt>    <dbl>
                              #> 1 karl_base_r(data_large, dicts)      856ms   856ms      1.17   503.9MB     9.35
                              #> 2 tim_across(data_large, dicts)       647ms   647ms      1.55   504.9MB    10.8 
                              #> 3 tim_lmap(data_large, dicts)         809ms   809ms      1.24   503.6MB    11.1 
                              #> 4 thomas_base_r(data_large, dicts)    131ms   148ms      6.53    80.1MB     3.27
                              #> 5 sindir_base_r(data_large, dicts)    150ms   180ms      5.08    80.1MB     5.08
                              
                              library(tidyverse)
                              library(magrittr)
                              
                              # Starting tibble
                              data <- tibble(Names = c("Alice","Bob","Cindy"),
                                             A = c(3,"q",7),
                                             B = c(1,2,"b"),
                                             C = c("a","g",9))
                              
                              # Named vector
                              A <- c("5" = "alpha", "7" = "bravo", "3" = "charlie", "q" = "delta")
                              B <- c("1" = "yes", "2" = "no", "b" = "bad", "c" = "missing")
                              C <- c("9" = "beta", "8" = "gamma", "a" = "delta", "g" = "epsilon")
                              
                              # Named list of named vectors
                              dicts <- list("A" = A, "B" = B, "C" = C) # Same names as columns
                              
                              
                              # function definitions 
                              
                              karl_base_r <- function(data, dicts) {
                                for (x in names(dicts)) 
                                  {data[[x]] <- do.call(recode, c(list(data[[x]]), dicts[[x]])) }
                                
                                data
                              }
                              
                              tim_across <- function(data, dicts) {
                                
                                myfun <- function(x) {
                                  mycol <- cur_column()
                                  dplyr::recode(x, !!! dicts[[mycol]])
                                }
                                
                                data %>% 
                                  mutate(across(c("A", "B", "C"), myfun))
                              }
                              
                              tim_lmap <- function(data, dicts) {
                                myfun2 <- function(x) {
                                  x_nm <- names(x)
                                  mutate(x, !! x_nm := recode(!! sym(x_nm), !!! dicts[[x_nm]]))
                                }
                                
                                lmap_at(data, 
                                        names(dicts),
                                        myfun2)
                              }
                              
                              sotos_pivot <- function(data, dicts) {
                                data %>% 
                                  pivot_longer(-1) %>% 
                                  left_join(stack(dicts) %>% 
                                              rownames_to_column('value'),
                                            by = c('value',  'name' = 'ind')) %>% 
                                  pivot_wider(id_cols = -value, names_from = name, values_from = values)
                              }
                              
                              thomas_base_r <- function(data, dicts) {
                                idx <- match(names(dicts), names(data))
                                data[idx] <- Map(`[`, dicts, data[idx])
                                data
                              }
                              
                              sindri_base_r <- function(data, dicts) {
                                look_dict <- function(col, values) dicts[[col]][values]
                                
                                data[names(dicts)] <- lapply(names(dicts), \(col) look_dict(col, data[[col]]))
                                data
                              }
                              
                              library(purrr)
                              library(tibble)
                              
                              test %>% 
                                lmap_at(c("A", "B", "C"), 
                                        ~ as_tibble_col(dicts[[names(.x)]][unlist(.x)], names(.x)))
                              
                              # # A tibble: 3 x 4
                              #   Names A       B     C      
                              #   <chr> <chr>   <chr> <chr>  
                              # 1 Alice charlie yes   delta  
                              # 2 Bob   delta   no    epsilon
                              # 3 Cindy bravo   bad   beta
                              

                              Why is a segmentation fault not recoverable?

                              copy iconCopydownload iconDownload
                              void test(float *p, int *q)
                              {
                                float temp = *p;
                                if (*q += 1)
                                  function2(temp);
                              }
                              

                              Community Discussions

                              Trending Discussions on q
                              • How to override a nested npm sub-dependency with a different package altogether (not just different package version number)?
                              • Google OAuth 2.0 failing with Error 400: invalid_request for some client_id, but works well for others in the same project
                              • android:exported needs to be explicitly specified for &lt;activity&gt;. Apps targeting Android 12 and higher are required to specify
                              • One or more issues found when checking AAR metadata values:
                              • How do I calculate square root in Python?
                              • What is the correct way to install Android Studio Bumblebee 2021.1.1 Patch 1
                              • Understanding color scales in ggplot2
                              • How can I efficiently calculate a quadratic form in Julia?
                              • What is the significance of 'strongly happens before' compared to '(simply) happens before'?
                              • Use recode to mutate across multiple columns using named list of named vectors
                              Trending Discussions on q

                              QUESTION

                              How to override a nested npm sub-dependency with a different package altogether (not just different package version number)?

                              Asked 2022-Apr-04 at 01:19
                              Overview

                              I am having trouble resolving a ReDoS vulnerability identified by npm audit. My application has a nested sub-dependency ansi-html that is vulnerable to attack, but unfortunately, it seems that the maintainers have gone AWOL. As you can see in the comments section of that Github issue, to get around this problem, the community has made a fork of the repo called ansi-html-community located here, which addresses this vulnerability.

                              Thus, I would like to replace all nested references of ansi-html with ansi-html-community.

                              Problem

                              My normal strategy of using npm-force-resolutions does not seem to be able to override nested sub-dependencies with a different package altogether but rather only the same packages that are a different version number. I have researched this for several hours, but unfortunately, the only way I have found to fix this would appear to be with yarn, which I am now seriously considering using instead of npm. However, this is not ideal as our entire CI/CD pipeline is configured to use npm.

                              Does anyone know of any other way to accomplish nested sub-dependency package substitution/resolution without having to switch over to using yarn?

                              Related Questions

                              These are questions of interest that I was able to find, but unfortunately, they tend to only discuss methods to override package version number, not the package itself.

                              Discusses how to override version number:

                              How do I override nested NPM dependency versions?

                              Has a comment discussion about npm shrinkwrap (not ideal):

                              npm - how to override a dependent package's dependencies?

                              Other related StackOverflow questions:

                              CSE Index of related questions

                              ANSWER

                              Answered 2021-Oct-29 at 21:01

                              I figured it out. As of October 2021, the solution using npm-force-resolutions is actually very similar to how you would specify it using yarn. You just need to provide a link to the tarball where you would normally specify the overriding version number. Your resolutions section of package.json should look like this:

                              "resolutions": {
                                  "ansi-html": "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz"
                              }
                              

                              To find the link to the tarball, use the following command, modifying your registry as necessary:

                              npm view ansi-html-community dist.tarball --registry=https://registry.npmjs.org/
                              

                              Also, note that for npm-force-resolutions to work when you run npm install, you will need a preinstall entry under the scripts section of package.json:

                                "scripts": {
                                  "preinstall": "npx npm-force-resolutions"
                                }
                              

                              Source https://stackoverflow.com/questions/69548370

                              Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                              Vulnerabilities

                              No vulnerabilities reported

                              Install q

                              You can download it from GitHub.
                              You can use q like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

                              Support

                              Any feedback/suggestions/complaints regarding this tool would be much appreciated. Contributions are most welcome as well, of course. Linkedin: Harel Ben Attia. q on twitter: #qtextasdata. Patreon: harelba - All the money received is donated to the Center for the Prevention and Treatment of Domestic Violence in my hometown - Ramla, Israel.

                              DOWNLOAD this Library from

                              Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                              over 430 million Knowledge Items
                              Find more libraries
                              Reuse Solution Kits and Libraries Curated by Popular Use Cases
                              Explore Kits

                              Save this library and start creating your kit

                              Explore Related Topics

                              Share this Page

                              share link
                              Reuse Pre-built Kits with q
                              Consider Popular CSV Processing Libraries
                              Try Top Libraries by harelba
                              Compare CSV Processing Libraries with Highest Support
                              Compare CSV Processing Libraries with Highest Quality
                              Compare CSV Processing Libraries with Highest Security
                              Compare CSV Processing Libraries with Permissive License
                              Compare CSV Processing Libraries with Highest Reuse
                              Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                              over 430 million Knowledge Items
                              Find more libraries
                              Reuse Solution Kits and Libraries Curated by Popular Use Cases
                              Explore Kits

                              Save this library and start creating your kit

                              • © 2022 Open Weaver Inc.