Q:

how to make an If statment within lambda function that returns what isn't in the find all string

Basically this is my script below:
# importing pandas module with an alias of PD
import pandas as pd

# importing python regex 
import re

# data contains the content of the .csv file using pandas read_csv function
data = pd.read_csv('data1010.csv')

# shows only the tags that are matching Up and have a digit between 0-9, then picks up any characters between the _ and the commma
data['tags'] = data['tags'].apply(lambda x : ",".join(re.findall("Up\d?_\S*(?=,)", x)))

# Excludes the tags that are blank
data = data[ (data['tags'] == "") == False]

#creates a new column called total_tags and returns a count of how many elements are between commas
data["total_tags"] = data["tags"].apply(lambda x : len(x.split(',')))

# prints first 5 lines of csv
print(data.head())
# exports everything to test.csv and removes the index column
data.to_csv("test.csv", index = False)

What I want to now do is for every tag that doesn't match the join(re.findall("Up\d?_\S*(?=,)", x) I want it to be returned in the same column.
So what it will do now 
is return the below:
+--------------+-------+-----------------+--------------+--------------+-------------+
| product_id   |  sku  |    total_sold   |     tags     | total_images | total_tags  |
+--------------+-------+-----------------+--------------+--------------+-------------+
| grgeggre     | rgerg |             456 | Up1_, Up2    |            5 |           2 |
| grgrer       | agag  |             431 |              |            5 |             |
+--------------+-------+-----------------+--------------+--------------+-------------+

(removes and makes blank if no up_ tags)
I want it to continue doing the same but instead of populating blanks it will return only the tags that do not contain Up_, Up*_. below is an example of this but is a fake tag because they are all different:
+--------------+-------+-----------------+--------------+--------------+-------------+
| product_id   |  sku  |    total_sold   |     tags     | total_images | total_tags  |
+--------------+-------+-----------------+--------------+--------------+-------------+
| grgeggre     | rgerg |             456 | Up1_, Up2    |            5 |           2 |
| grgrer       | agag  |             431 | tag-c, tag-d |            5 |           2 |
+--------------+-------+-----------------+--------------+--------------+-------------+

A:

data['tags'] = data['tags'].apply(lambda x : ",".join(re.findall("Up\d?_\S*(?=,)", x)) if re.findall("Up\d?_\S*(?=,)", x) else x )

This works for anyone interested.

