kapa.ai how do i create a cohort from a csv
To create a cohort from a CSV file in Mixpanel, you can follow these steps: 1. First, prepare your CSV file:
- Your CSV should not include column headers (like email, etc.)
- Make sure one column contains the identifier that will match your users (typically the $distinct_id
)
- The maximum size for your CSV should be 1M rows2. Go to the Users page in Mixpanel and click on Add/Edit Profile3. Select the Import from CSV tab and upload your prepared CSV file4. Choose an identifier column:
- The most important column is $distinct_id
for user profiles
- This value needs to match the distinct_id
property value you're sending on your events
- If you don't assign an identifier column, Mixpanel will use your $email
column as the $distinct_id
value (or assign random values if no email column exists)5. Select which CSV columns to import:
- Uncheck any columns you don't want to import
- Map each CSV column to the appropriate Mixpanel profile property
- Click Import profiles to proceed6. After importing the profiles, go to the Cohort Builder to create a cohort based on these profiles7. Create a cohort by filtering for a unique property you included in your CSV. For example, if you added a property like "Cohort = Android Users" to all profiles in your CSV, you can filter for users with that property and save them as a cohortUser Profiles guide provides more details on importing profiles via CSV.Note that cohorts created this way will remain static (they won't update automatically over time) since they're based on unchanging properties.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
Let me check the knowledge base for you again. One moment! 📚
I understand your concern about not wanting to create a new user trait when importing a CSV to create a cohort. Let me provide you with alternative approaches: You can create a cohort directly from a list of users without adding new user traits by: 1. Exporting Users from an Existing Project: If you have the data in another Mixpanel project, you can use a script to export user profiles: ```from mixpanel_api import Mixpanel
if name == 'main':
api_secret = 'YOURAPISECRET' project_token = 'YOURPROJECT'
m = Mixpanel(api_secret,token=project_token, pool_size=4, debug=True)
selector = '' behaviors = '' parameters = {'selector': selector, 'behaviors': behaviors} m.export_people('people_export.csv',parameters,timezone_offset=-8,format='csv')```Then use this exported list to create your cohort Steps for Project Migration.2. Using the Cohort Builder with Existing Properties: Instead of adding new properties, you can filter based on existing properties that your users already have, such as email addresses or IDs that match your CSV list.3. Downloading and Exporting Cohorts: If you already have the cohort defined elsewhere, you can export it and then import it into Mixpanel Exporting Cohorts.If you're still facing challenges, you might want to consider using Mixpanel's integration options to sync cohorts from other platforms, which wouldn't require creating new user traits.Would any of these approaches work better for your use case?
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
wow none of these answered my question
Hi Eric, thanks for the response. It seems that to create a cohort from a CSV I would need to edit user profiles (the upload function is to modify profiles). I presume I would either need to modify a profile property, or create a new one (e.g. cohort_1), and then go to the cohorts section to filter for that property. The way I’ve been doing it so far has been to copy a list into the filter section in the cohort builder, but that’s not always accurate, and in the past I’ve had issues with large cohorts (have to import in blocks). Yes, an “import from csv” would be helpful as a part of the cohort builder.