Home

Python random sample percentage

  • Python random sample percentage. sample(c,4) My classification then starts with: for i in random_sample: Jun 11, 2014 · There are many ways to create a train/test and even validation samples. cons: too limited, there are so many other good algorithms for string similarity out there. 7 Sep 14, 2012 · Where although it may not be clear here, the sample names are in the 1st column, and the values correspond to Dog, cat or Tarsier. I have 10 things that I want to be printed if they are picked. It produces a sample, based on how many samples we'd like to observe: import random letters = ['a', 'b', 'c', 'd', 'e', 'f'] print (random. def balanced_sample_maker(X, y, random_seed=None): """ return a balanced data set by oversampling minority class. choice() returns a single random element, while sample() and choices() return a list of multiple random elements. 1. randrange() function completely eliminates bias (it uses the internal _randbelow() method that makes multiple random choices until a bias-free result is found). Jun 3, 2016 · If you want 20 unique values in random order, use random. Apr 14, 2022 · there are many ways to implement this sampling — one such way is called Inverse Transform Sampling. k: An Integer value, it specify the Mar 25, 2013 · You could look at it as a dice roll; 100% of the time, you'll roll a value < 7 with a standard 6-sided dice. Compute the q-th percentile of the data along the specified axis. Syntax : numpy. Jul 12, 2022 · 0:38 – Starting off with an evenly split sample without weights; 1:52 – Going over weighted sampling, starting off with the “why” 4:16 – Breaking down the problem using dice rolls as a comparison; 6:01 – Running the Ruby code to pick a weighted sample; 6:32 – Going back to how our weighted_sample function works Sep 26, 2018 · Return a random sample of items from an axis of object. Return a k length list of unique elements chosen from the population sequence or set. Number of items from axis to return. append(str(path)) # because path is object not string. randrange(start(opt),stop,step(opt)) Parameters : start(opt) : Number consideration for generation starts Jan 28, 2018 · 3. groupby('Group_Id'). createDataFrame([(1,2),(1,3),(1,9),(2,4),(2,10),(3,5),(2,9),(3,6),(3,8),(4,9 18. array(sample(xrange(len(df)), 10)) # get 10 random rows from df. tst= sqlContext. I'm looking for a way to extract a number N of random samples between a given interval using my own distribution as fast as possible in python. Source code: Lib/random. Random sampling has applications in statistics where often times a random subset of a population is observed and used to make inferences about the overall population. from numpy import unique. train, test = train_test_split(df, test_size=0. sample. Aug 29, 2023 · With the help of choice() method, we can get the random samples of one dimensional array and return the random samples of numpy array. DataFrame. This is because you’ve fixed the random number generator with random_state=4. 05954861408025609 isn’t an integer multiple of 2⁻⁵³. rindex = np. randint(numLow, numHigh)) However, I need to make sure each number in that list is unique. Cannot be used with frac . seed(887) grp<-sample(LETTERS[1:4],20,replace=TRUE) Score<-sample(101:150,20) df1<-data. use SequenceMatcher from difflib. shuffle is an in-place operation. randint. Returns the q-th percentile (s) of the array elements. From the documentation. random_sample (size = None) # Return random floats in the half-open interval [0. sample(n=int(positions[obj. 50=3 farmers from Group :"M,SC", 6x0. zeros(arr_len, dtype=int) idx = np. The confidence interval is then mean +/- z*sigma, where sigma is the estimated standard deviation of your sample mean, given by sigma = s / sqrt(n), where s is the standard deviation computed from your sample data and n is your sample size. df1_percent = df1. 881 7 5. np. The size keyword specifies the number of values to generate. dataframe to a numeric matrix and using scikit-learn's train_test_split to do the splitting unless you really want to do it this way. 0, 1. import numpy as np. Getting Started with the random Module. join([random. I want to take a random sample of 4 pieces of text and their class from it. Date Set: Now, Using Sampling, I have to select 6 farmers, where 6x0. k Sep 26, 2014 · 8. randint(0, k) if i < nof_samples: random. It selects random samples between [0. append(random. Percentage or sequence of percentages for the percentiles to compute. #. Sep 10, 2020 · Python offers a function that can generate random numbers from a specified range and also allowing rooms for steps to be included, called randrange () in random module. random_sample# random. 6+ only oneliner: f'{random. 1) 2. I'm trying to get a get a random boolean but with a weighted percentage. This function is incredibly useful when you need to pick a subset of data from a larger dataset in a manner that ensures fairness and a lack of bias. Feb 24, 2021 · Next we can begin the search and then fit a new random forest classifier on the parameters found from the random search. ihadanny. choice(x) for _ in range(v)]) print string. 3. print(l) # outputs [4, 1, 5, 0, 6, 7, 9, 2, 8, 3] Below is my python implementation for creating balanced data copy. 6 or above then use the random. if set to a particular integer, will return same rows as sample in every iteration. This is because each tree in the forest is trained on a random subset of the data points with replacement (called bagging, short for bootstrap aggregating). list, tuple, string or set. Aug 22, 2018 · I am classifying the text, and then comparing it to the correct class labeled in the csv file. Syntax: numpy. Jun 29, 2020 · You can use distinct and sample functions of pyspark followed by join. import pandas as pd. iloc[ind[:int(0. from random import sample. choice() は要素を一つ選択、 sample(), choices() は複数 Jun 16, 2021 · Choose 20 – 25% of the time. 语法: random. choice([char for char in 'abc'], size=1000, replace=True) : Examples of how to use the Python to generate random numbers. sample(letters, 3)) Oct 26, 2021 · The method is called using . To sample U n i f [ a, b), b > a multiply the output of random_sample by (b-a) and add a: (b - a) * random_sample() + a. For sequences, there is uniform selection of a random element, a function to generate a random permutation of a list in-place, and a function for random sampling without replacement. Dec 2, 2021 · Pick a Random Element from a List in Python. sample(coordinates, 20) random. Mar 5, 2020 · I am trying to modify the code so instead of just adding random numbers between 1000-2000. >>> [random. choice ( a , size = None, replace = True, p = None) Parameters: a: a one-dimensional array/list (random sample will be generated from its elements) or an integer (random samples Oct 26, 2015 · I've used 'sample' to select a sample of of the population who work part time and then I will add this data as a new column, but I have yet to figure out how to ensure those selected are not reselected in the next sample for a different employment type. sample(population, k)¶. ratio() 0. ''' Random sampling - Random n% rows '''. Use a NumPy module to generate a multidimensional array of random numbers. sample(n=None, frac=None, replace=False, weights=None, random_state=None, axis=None) As OP pointed out, the interaction between class_weight and sample_weight determine the sample weights used to fit each decision tree of the random forest. from numpy import random. Using weights. max() 1000 I want to add random numbers that are for example 5% bigger than the max value Jul 11, 2022 · With a 1 line function you can randomly pick item A X% time and item B Y% time. Elements can be used more than once. py. for x in range (0, n): listOfNumbers. I have: import random textt=data['Text'] class_one=data['Class'] c=textt[0:] random_sample=random. For integers, there is uniform selection from a range. model_selection import train_test_split. block_start_idx = 1000 * i. Hit the subscribe button to receive more videos like this!REFERENCE LINKS----- Dec 27, 2017 · An interesting observation is that in the root node, there are only 162 samples despite there being 261 training data points. Make the random choices from the numbers list. sample(frac=1, random_state=1729), [int(0. sample() function is a method available in Python's built-in random library. Parameters: nint, optional. random returns a floating point number, a continuous range, while randrange returns an int by default, so it's a set of discrete points within the range. In Python 2, the random. sample(n=None, frac=None, replace=False, weights=None, random_state=None) [source] #. Aug 16, 2023 · In Python, you can randomly sample elements from a list using the choice(), sample(), and choices() functions from the random module. else: i = random. May 8, 2018 · Timing the three answers so far and random. ix[rows] answered Jun 18, 2013 at 14:41. randint(numLow, numHigh) And I know I can put this in a loop to generate n amount of these numbers. title. Example. array(. random(): Generating Floats in the Range [0. Return random floats in the half-open interval [0. exp(result. For instance, for sample A47, I would want to retrieve something like this: Cat Tarsier A47 7 2 Dec 15, 2018 · I have issues to understand the following coding and I am new to python: data_a, data_b, data_C = np. In other words, if I have a Pandas dataframe with a Label column, I'd like to drop 50% (or some other percentage) of rows where Label == 1, but keep all of the rest: Label A -> Label A 0 1 0 1 0 2 0 2 0 3 0 3 1 10 1 11 1 11 1 12 1 12 1 13 Nov 25, 2019 · Here's a python function that will select random features in a layer based on percent, ignoring current selection: def SelectRandomByPercent (layer, percent): #layer variable is the layer name in TOC #percent is percent as whole number (0-100) if percent > 100: print "percent is greater than 100" return if percent < 0: print "percent is less than zero" return import random fc = arcpy. Cannot be used with frac and must be no larger than the smallest group unless Nov 24, 2010 · I wrote a solution for drawing random samples from a custom continuous distribution. NumPy has the numpy. Importing the random Module; Setting the Random Seed; Generating Random Numbers. rows = np. arange(df. Values must be between 0 and 100 inclusive. sample(frac = 1. Used for random sampling without replacement. 7) print(df1_percent) so the resultant dataframe will select 70% of rows randomly Series. It is primarily used to retrieve a unique random sample from a population each time it's called. – Aug 30, 2023 · By the end of this tutorial, you’ll have a solid understanding of how to use the random module effectively in your Python programs. If you want a 50 item sample from block i for example, you can do: import numpy as np. Aug 30, 2012 · For example you can pass the index values from a DataFrame and and the integer 10 to select 10 random uniformly sampled rows. Code. sample (sequence, k) Parameters: sequence: Can be a list, tuple, string, or set. sample() The first method that we can make use of to select more than one element at random is random. DataFrameGroupBy. Table of Contents. However, many other representable floats in that interval are not possible selections. random package has multiple functions to generate the random n-dimensional array for various distributions. You could take a 5% sample of the index, create a copy of the values at those indices, shuffle the values, then reassign. (We can turn off the sampling with replacement and use all the Mar 31, 2021 · 1. The number of samples to be extracted can be expressed in two alternative ways: specify the percentage of random rows to extract. Use iterators/generators so you won't keep all files in memory. Below are the ways by which we can randomly select rows from Pandas DataFrame: Using sample () Method. 用于无替换的随机抽样。. randint (1,100)) if chance < 20: print ("20% chance of getting this") The problem is that if I do another one with say, chance <25, if the randint is 10 Mar 9, 2022 · The uuid_list_sample that I generate is the correct length. Describe Mar 9, 2019 · The default random() returns multiples of 2⁻⁵³ in the range 0. Python3. 75 Solution #2: jellyfish You’d get the same result with test_size=0. list = [2, 2, 4, 6, 6, 8] Solution #1: Python builtin. Consider the below data frame −. n= None, frac= None, replace= False, weights= None, random_state= None, axis= None, Jun 16, 2021 · PRNG is an acronym for pseudorandom number generator. pros: built-in python library, no need extra package. 3) replace - Whether the sample Oct 14, 2020 · To create a random sample of some percentage of rows for a particular value of a column from an R data frame we can use sample function with which function. choice(range(arr_len), num_ones, replace=False) arr[idx] = 1 Out: Mar 18, 2014 · for randomly selecting just one row per group try: df. Using Fraction of Rows. Jan 5, 2021 · The two main approaches to randomly resampling an imbalanced dataset are to delete examples from the majority class, called undersampling, and to duplicate examples from the minority class, called oversampling. choices from the comments (skipping the ''. 75 Solution #2: jellyfish Dec 9, 2020 · Given a dataset like this: import pandas as pd rows = [{'key': 'ABC', 'freq': 100}, {'key': 'DEF', 'freq': 60}, {'key': 'GHI', 'freq': 50}, {'key': 'JKL', 'freq': 40 Generating Random Numbers Using random. Note: This method does not change the original sequence. You just need the funtion random_custDist and the line samples=random_custDist(x0,x1,custDist=custDist,size=1000). sample(group_of_items, num_to_select) first_random_item = list_of_random_items[0 Another way of getting the exact number of ones and zeroes is to sample indices without replacement using np. sample () sample ()是Python中随机模块的一个内置函数,它返回一个从序列即列表、元组、字符串或集合中选择的特定长度的项目列表。. So I have 2 questions: How do I get the above code to work as intendend? Return a random portion of the pandas df based on index; How do I in general get a percentage of the whole pandas data frame? I was looking at pandas. (Though note that this does not guarantee a median of exactly 40. I want to keep, let's say 90% of the data for each sample and delete the rest IN PYTHON. Dec 1, 2021 · A random sample satisfying each of your conditions could be generated (respectively) like this: Filter for under 40s, randomly sample n/2, then do the same for over-40s and then combine them. Return a random sample of items from each group. data_numbers. 6609991871223335, 0. For example, if I want to generate a number to simulate the roll of a six-sided die, I need to generate a number in the range 1-6 (including the endpoints 1 and 6). sample (sequence, k) 参数:. sample(ab, int(len(a)*(1-frac))) # sample those tuples new_a, new_b = zip(*new_ab Dec 1, 2023 · A random selection of rows from a DataFrame can be achieved in different ways. columns[1:] logit = sm. Example 5 - A random percentage between 1 and 100 to two decimal places Jul 26, 2011 · 13. 0 ≤ x < 1. # create random index. numpy. random_state: int value or numpy. If you are using Python 3. split(original_data. If you are sampling from a population of individuals whose data are represented in the rows of a table, then you can use the Table method sample Jul 4, 2021 · Alternatively if you don't want to save the random number as an int you can just do it as a oneliner: '{:03}'. choice(1000, replace=False, size=50) df_trimmed = df. The function takes a single parameter – a sequence. awesome. fit() exp = np. randrange(1, 10**3)) python 3. However each should have a different percentage chance of happening though. Use random. If you want to randomly select more than one item from a list, or select an item from a set, I'd recommend using random. even with a fairly efficient self-implementation of this we are around 40x slower than SciPy. sample(. l = range(10) # example list. Sep 8, 2020 · Python provides many useful tools for random sampling as well as functions for generating random numbers. 2. index. You can get a number of random indices from your array by using: indices = np. This is the fastest answer, and it works for selecting rows that span multiple columns. This module implements pseudo-random number generators for various distributions. Jul 7, 2021 · Random Sampling. random() return value just has a much larger If you wanted to generate a sequence of random numbers, one way to achieve that would be with a Python list comprehension: Python. frame(grp,Score) df1 Output Aug 16, 2023 · The random. 4,407 9 48 80. 0 – 1. values, 10) sampled_df = df. params) 10. In this case, our sequence will be a list, though we could also use a tuple. chosen_idx = np. randrange () method. Results are from the “continuous uniform” distribution over the stated interval. Using frac parameter. We can build a single sample as well as an entire array based on random values. choice () function is used to get random elements from a NumPy array. All such numbers are evenly spaced and are exactly representable as Python floats. import random a = [0,1,2,3,4,5,6,7,8,9] b = [0,1,4,9,16,25,36,49,64,81] frac = 0. For example, 0. choice(a, size=None, replace=True, p=None) Parameters: 1) a - 1-D array of numpy having random samples. For instance, for sample A47, I would want to retrieve something like this: Cat Tarsier A47 7 2 Apr 23, 2023 · Method 1: Generate random integers using random. One of the primary ways we generate random numbers in Python is to generate a random integer (whole number) within a specified range. In the above example I created a dataframe with 5000 rows and 2 columns, first part of the output. head(1) edited Mar 23, 2022 at 18:03. 3 days ago · This module implements pseudo-random number generators for various distributions. NumPy random_sample () method for Random Sampling. Have a look at the below syntax! . For instance, I want the user to pass in a percentage (i. ) If you want to combine the two constraints, you might need to sample 4 times - women Mar 19, 2015 · To retrieve the index of the randomly selected value in your list you could use enumerate that will return the index and the value of an iterable as a tuple: import random. Dec 2, 2021 · The numpy. sample(): random. Note: The specified number ( k=2) cannot be longer than the length of the original sequence. Return type: New object of same type as caller. random. Case 1: classic way train_test_split without any options: from sklearn. Nov 22, 2020 · If I understood correctly this is what you want: import random import numpy as np x = np. For example random. 5854998250783767, 0. Further, random number generation has many application in the sciences. DataFrame. 10. Aug 16, 2023 · パワフルで多用途な言語である Python は、 random. import random. choice s () Else, use a numpy. 7*df. sample() 関数を提供しており、データから迅速かつ効率的にランダムサンプルを作成することができます。. ind = np. 67% of the time you'd roll a value less than 5 (so 2/3rds of all your rolls). With random_sample () method, we can sample the data values and choose random data fat ease. Choose 30 – 50% of the time. percentile. I needed this for a similar use-case to yours (i. It is a built-in function in the NumPy package of python. from random import choice. with ipython timeit it takes half of random. ITS relies on inverting the cdf of a given distribution before plugging in uniformly distributed random numbers to it. sample time. shuffle(l) # we shuffle the list. Create the seed for random number generator, I have put it at 2. generating random dates with a given probability distribution). Before diving into some examples, let’s take a look at the method in a bit more detail: DataFrame. Syntax : random. If you want to generate a number of random booleans you could use numpy's random module. random() for _ in range(5)] [0. set. It should add in percentage, so lets say my max value is. Selecting more than n rows. shape[0]) np. quantile, but Im not sure if that does what im Oct 14, 2015 · Here is my current code which right now runs by selecting all of the columns and rows and fitting it into my model but I would like to dictate a random percentage: train_cols = df. list_of_random_items = random. 0] only. Aug 29, 2018 · sample () is an inbuilt function of random module in Python that returns a particular length list of items chosen from the sequence i. Assumptions: 1. At the moment I have the following which is for 23% of Male in a certain age group: Here are the steps to follow: Import the libraries. Python pandas provides a function, named sample() to perform random sampling. Nov 26, 2022 · Say you want 50 entries out of 100, you can use: import numpy as np. pandas. choice() We will see how to use both one by one. randrange(1, 10**3):03}' Example outputs of the above are: '026' '255' '512' Implemented as a function that can support any length of digits not just 3: Mar 14, 2023 · Select randomly n elements from a list using choice () The choice () method is used to return a random number from given sequence. Apr 24, 2020 · replace: Boolean value, return sample with replacement if True. There’s one more very important difference between the last two examples: You now get the same result each time you run the function. A Dataframe is a two-dimensional data structure, like data is aligned in a tabular fashion in rows and columns. sample() function is slightly biased but only in the round-off in the last of 53 bits. This is what I mean: def my_dist(x): # Some distribution, assume c1,c2,c3 and c4 are known. 4031628347066195, 0. choice() function. Python random. name] * total), replace=replace) Output. The random. More to this function is discussed in this article. rvs() function returns a random sample of the distribution with probability equal to the distribution -- if something is 80% likely, that value will be sampled 80% of the time. In this tutorial, you will discover random oversampling and undersampling for imbalanced classification. rf_base = RandomForestClassifier() rf_random = RandomizedSearchCV(estimator = rf_base, param_distributions = random_grid, n_iter = 30, cv = 5, verbose=2, random_state=42, n_jobs = 4) rf_random. I tried doing the following: chance = (random. If your percentage chance falls between the discrete points, it's like rounding it up or down to the nearest. Random n% of rows in a dataframe is selected using sample function and with argument frac as percentage of rows as shown below. Python provides a function named randrange () in the random package that can produce random numbers from a given range while still enabling spaces for steps to be included. import random group_of_items = {'a', 'b', 'c', 'd', 'e'} # a sequence or set will work here. The below example uses randrange () to randomly print integers. Keep in mind that np. Group wise percentage as below. Random Sampling in Python #. The simplest way to use Python to select a single random element from a list in Python is to use the random. In COIN, we expect more results with 1 (50% occurrence of 1 head) than 0 or 2 (25% occurrence of either zero heads or two heads). sample(). fit(training, training_labels) Oct 25, 2021 · Pandas is an open-source library that is built on top of numpy library. Note. randint(1,101,100) _25_percent = int(len(x)/4) # 100/4 = 25; 25% of May 11, 2023 · Python標準ライブラリのrandomモジュールの choice(), sample(), choices() 関数を使うと、リストやタプル、文字列などのシーケンスオブジェクトからランダムに要素を選択して取得(ランダムサンプリング)できる。. As you know, using the Python random module, we can generate scalar random numbers and data. Prepare a list of numbers from which to pick up in a random way. Dec 11, 2018 · 3. choice: arr_len = 30 num_ones = 8 arr = np. Code: from random import seed. shape[0], number_of_samples, replace=False) You can then use fancy indexing with your numpy array to get the samples at those indices: A[indices] This will get you the specified number of random samples from your data. May 5, 2014 · In Python 2 and Python 3, the random. Logit(df['Won'], df[train_cols]) result = logit. if k < nof_samples: rc. 021655420657909374, 0. Dec 31, 2013 · You are not looking for a subset; you want single random choices from the input sequence, repeated a number of times. 60) and the generator will randomly select true 60% of the time. The rest is decoration ^^. 4. sequence: 可以是一个列表,元组,字符串,或集合. sample() Method can be used to divide the Dataframe. There are 2 ways to make weighted random choices in Python. 42886606317322706] Select random n% rows in a pandas dataframe python. . num_to_select = 2 # set the number to select here. And use Reservoir sampling to pick selected samples from the basically a stream of file names. If we inspect _validate_y_class_weight(), fit() and _parallel_build_trees() methods, we can understand the interaction between class_weight, sample_weight and bootstrap parameters better. axis: 0 or ‘row’ for Rows and 1 or ‘column’ for Columns. answered Dec 7, 2011 at 22:39. Using replace = false. e. You can use random_state for reproducibility. join part since we all used it) producing 1000 samples from the string 'abc', we get: numpy. sample() and provides a number of helpful parameters that we can apply. 1 is the minority. The sample() method returns a list with a specified number of randomly selected items from a sequence. Return a random sample of items from an axis of object. Number of items to return for each group. Syntax: DataFrame. 0% of the time you'll roll a value < 1, 50% of the time you'll roll a value < 4 (1, 2 or 3), and 66. 0). answered Oct 10, 2017 at 6:38. a = np. This creates a string of length v, where characters from x can Apr 3, 2014 · I know how to generate a random number within a range in Python. shuffle(ind) X_train = df. random. choice() in a loop for this: for i in range(y): string = ''. python3. The . Given a dataframe with N rows, random Sampling extract X random rows from the dataframe, with X ≤ N. Start with looking up the z-value for your desired confidence interval from a look-up table. sample instead. example: >>> from difflib import SequenceMatcher >>> s = SequenceMatcher(None, "abcd", "bcde") >>> s. shape[0]):],:] I would suggest converting the pandas. Input array or object that can be converted to an array. Choose 40 – 15% of the time. gauss will sample random point from a normal distribution with a given mean and sigma values. Using parameter n. iloc[ind[int(0. May 23, 2022 · I have to select 6 Farmers out of 18 farmers using Stratified Random Sampling where percentage is given for sampling. iloc[chosen_idx] This is of course not considering your block structure. This returns a single value from available data that considers duplicate values in the sequence (list). target variable (y) is binary class (0 vs. k Solution #1: Python builtin. 1. sample(frac=0. 0) Jan 26, 2021 · How to generate a list of random numbers with the 5% occurance of particular values? 0 Generating a random list from a tuple but being able to select percentage of each item If a and b are not very large, you could get away with using zip:. format(random. RandomState, optional. 25=2 farmers from group F,SC and 1 farmer from Group M,ST will be select. randint(2, size=10) will return 10 random uniform integers in the open interval [0,2). shape[0])],:] X_test = df. Review: Sampling from a Population in a Table #. The best way to do this is with the sample function from the random module, import numpy as np. dragoljub. Jul 8, 2010 · random. # given data frame df. choice(A. Live Demo. The trick is to use sample in each group, a code example: return obj. These functions can also be used with strings and tuples. random_sample(size=None) #. 2 # how much of a/b do you want to exclude ab = list(zip(a,b)) # a list of tuples where the first element is from `a` and the second is from `b` new_ab = random. 33 because 33 percent of twelve is approximately four. このガイドの目的は、Pythonのランダムサンプリング機能の包括的な理解を提供し、そのパフォーマンス Python random. user7864386. The sequence can be a list or a tuple. 2) size - Output shape of random samples of numpy array. This section summarizes the ways you have learned to sample at random using Python, and introduces a new way. Sep 14, 2012 · Where although it may not be clear here, the sample names are in the 1st column, and the values correspond to Dog, cat or Tarsier. choice(df. sample(n=None, frac=None, replace=False, weights=None, random_state=None, axis=None, ignore_index=False) [source] #. 3) Case 2: case of a very small datasets (<500 rows): in order to get results for all your lines with this cross Sep 27, 2023 · Selecting More than One Random Element from Python List Using random. What I have is this: Definition and Usage. 0. ui ql yk re vy vg jc hc de mi